Sunteți pe pagina 1din 51

PROJECT REPORT ON MICROCONTROLLER BASED DIGITAL CODE LOCK

Submitted By:
NAME : SHIKHA SARDANA(09) ANKITA GUPTA(22) SHRUTI SINGH(29) : B.TECH 4TH YEAR/8TH SEM

CLASS

ROLL NO. : 09,22,29 BRANCH : INSTRUMENTATION & CONTROL

Institute of Instrumentation Engg, Kurukshetra University, Kurukshetra

AUTHENTICATION CERTIFICATE
This is to certify that the work presented in this project is entirely carried out by SHIKHA SARDANA, ANKITA GUPTA & SHRUTI SINGH under my guidance and is submitted to Institute of Instrumentation Engineering,Kurukshetra University,Kurukshetra and this project has not been submitted by them to any other university for attainment of any degree/diploma/PG or certificate course.

Signature of the Project Guide (DR.D.S. RANA)

ACKNOWLEDGEMENT
This project has helped us learn a lot and enabled us to understand a lot about the applications of microcontrollers in various fields. This has been possible only due to the immense help extended by Dr.D.S.RANA, Sh.Suresh Ahlawat(electronic workshop incharge,I.I.E kuk), and Tushar Sachdeva Sir(student 2006-2010 batch at I.I.E kuk), who have gladly taken time off their busy schedule to make sure that our project proves worthwhile. We would like to thank them all profusely for all of their time and help as now we can say we have benefited a lot because of them. Thank You Sirs,
SHIKHA SARDANA

ANKITA GUPTA

SHRUTI SINGH

MICROCONTROLLER BASED CODE LOCK


ABOUT THE PROJECT:
Code locks can be constructed using digital and timer ICs employing pushbuttons or keypads for entering the code for authentication and operation of the code lock. However,such circuits would require a large number of ICs. On the other hand, a microcontroller-based code lock will require very few peripheral components.With the cost of microcontrollers now dropping to the equivalent cost of approximately four digital ICs, it makes sense to design simple logic circuits using microcontrollers and free version of programming languages. Although freeversion-language code length is normally limited to around 2 kB, but that is adequate for projects like this one.This simple code lock project is based on a 20pin ATMEL microcontroller AT89C2051. It employs a 5-digit sequential code with time-out security feature[1]. In addition to the microcontroller, the circuit uses a single additional IC (L293D) and IC(7404) to drive a motor. Although the project uses a liquid-crystal display (LCD), it is useful for design and developmental purpose only and is not really an essential part of the circuit. The same can be removed from the circuit without any change in the software.As regards LCD modules, these are available in 14- or 16-pin packages. The 16-pin variety has an additional backlight option. Popular brands available in India are Lampex, Hantronix and Hitachi. Most other models also have the same pin configuration. The model used in this project is Lampex LM16200 16character2-line alphanumeric dot-matrix display with backlight option.

CIRCUIT DESCRIPTION:
As already mentioned, the project makes use of ATMEL AT89C2051

microcontroller,in 20-pin DIP package,which supports 2 kB of flash-based program memory. A 6MHz crystal is used for providing the clock. Port-3 of the microcontroller is used to drive the LCD in 4-bit mode with 10-kilo-ohm pull-up resistors. The 10kilo-ohm resistor controls the contrast of the LCD panel.Timer 1 of AT89C2051 is used as an internal counter that increments a variable every second.After initialisation, the software switches on and waits for a 5-digit code to be entered. The valid code for this project is 56712. The code is entered using the twelve input switches(hex keypad) that are connected to port-1. One LED at port-1 is interfaced to P1.3 pin to provide microcontroller output(low) indication via LED whereas another LED is connected at pin-3 of L293D to indicate MOTOR ON.The P1.3 line is also interfaced to L293D at pin-2(input) of L293D through an inverter 7404 to switch on a motor, which can activate an electrically operated lock . The motor is connected between pin-3 and pin-6 of L293D(H-bridge).Whenever the correct lock is entered,we get a low output from pin P1.3 of AT89C2O51 which is inverted by 7404(inverter) to obtain a high output.This high output(5V) is fed to pin 2 of L293D which is a motor driver IC and works on 12V input and thus the output is taken between pin 3 and 6 of motor driver.After three unsuccessful attempts of entering the password, the circuit will wait for sometime (before accepting the next keystroke) to avoid unwanted tampering attempts. All these timings can be changed through the software program to suit your specific requirements.Also we can change the security 5-digit password by first entering 54321# and then entering the 10-digit master password 8776934265# and then entering the new 5-digit code(say 92229#) which will be saved for future[3].

PARTS LIST: Semiconductors:


IC1 - AT89C2051 microcontroller IC2 L293D (Motor driver/h-bridge) IC3 - 7805 +5V regulator IC4 7812 +12V regulator IC5 7804 (inverter) LED1 & LED2 - 5mm LED

Resistors (all -watt, 5% carbon):


R1, R2, R3, R5 1-kilo-ohm R4 - 330-ohm R6 - 10-kilo-ohm

Capacitors:
C1, C2 - 33pF ceramic disk C3 - 10F ceramic disk

Miscellaneous:
XTAL - 6MHz crystal S1- S13 - Push-to-on switch S1 - On/off switch 16-character2-line LCD(LM016L) 12V D.C Motor 18V Supply through batteries

MICROCONTROLLER AT89C2051:
The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with 2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications[2]. The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector twolevel interrupt architecture, a full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry. In addition, the AT89C2051 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The power-down mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.

Features:

Compatible with MCS-51Products 2K Bytes of Reprogrammable Flash Memory Endurance: 10,000 Write/Erase Cycles 2.7V to 6V Operating Range Fully Static Operation: 0 Hz to 24 MHz Two-level Program Memory Lock 128 x 8-bit Internal RAM 15 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial UART Channel Direct LED Drive Outputs On-chip Analog Comparator Low-power Idle and Power-down Modes Green (Pb/Halide-free) Packaging Option

PIN CONFIGURATION: 20-lead PDIP/SOIC:

BLOCK DIAGRAM

PIN DESCRIPTION:

VCC:- Supply voltage. GND: -Ground. Port 1:The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull-ups. P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1 output buffers can sink 20 mA and can drive LED displays directly. When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low, they will source current (IL) because of the internal pull-ups.Port 1 also receives code data during Flash programming and verification.

Port 3:Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is hard-wired as an input to the output of the onchip comparator and is not accessible as a general-purpose I/O pin. The Port 3 output buffers can sink 20 mA. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IL) because of the pull-ups.Port 3 also serves the functions of various special features of the AT89C2051 as listed below:

RST:Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for two machine cycles while the oscillator is running resets the device. Each machine cycle takes 12 oscillator or clock cycles.

XTAL1:-Input to the inverting oscillator amplifier and input to the


internal clock operating circuit.

XTAL2:-Output from the inverting oscillator amplifier. Oscillator Characteristics :The XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in figure below. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in figure below. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

4X3 HEX KEYPAD:


A keypad is the most widely used input devices of a microcontroller.At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, with a port of microcontroller, a 4X3 matrix of keys can be connected. When a key pressed, a row and column make a connection; otherwise, there is no connection between row and column[4]. HEX KEYPAD SCANNING AND INTERFACING: When a key is pressed, the row for that key will be physically connected to the column for that key. Therefore, the port input for the column will be at the same logic level as the port output for the row. Since the columns (inputs) are normally at the HIGH logic level due to pull-up resistors, the only way to make a column LOW will be to press a key and make the row for that key LOW. By periodically strobing each row LOW one row at a time, and reading the column input levels during each strobe, one can determine which key is pressed.

SCANNING ALGORITHM:
Keypads are often used as a primary input device for embedded microcontrollers. The keypads actually consist of a number of switches, connected in a row/column arrangement. In order for the microcontroller to scan the keypad, it outputs a nibble to force one (only one) of the columns low and then reads the rows to see if any buttons in that column have been pressed. The rows are pulled up by the internal weak pull-ups in the 8051 ports. Consequently, as long as no buttons are pressed, the microcontroller sees a logic high on each of the pins attached to the keypad rows. The nibble driven onto the columns always contains only a single 0. The only way the microcontroller can find a 0 on any row pin is for the keypad button to be pressed that connects the column set to 0 to a row. The controller knows which column is at a 0-level and which row reads 0,allowing it to determine which key is pressed. For the keypad, the pins from left to right are: R1, R2, R3, R4, C1, C2, C3, C4. A Column is generally high (output). One row at a time is made to go low(input) and than the columns are read. If one or more columns are low than the switches of the corresponding columns are active and their respective values should be displayed on the terminal.

16X2 LCD(LM016L):

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special and even custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data[5].The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling

display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

Pin diagram:

Pin description:-

IC 7404(INVERTER):
7404 is a NOT gate IC. It consists of six inverters which perform logical invert action. The output of an inverter is the complement of its input logic state, i.e., when input is high its output is low and vice versa[6]. Pin diagram:

Pin description:

IC L293D(MOTOR DRIVER):
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors[7]. L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively. Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state. Pin diagram:

Pin description:

ASSEMBLY PROGRAM:
ORG 0000H 0000| LJMP 032DH 0003| CLR A 0004| MOV 22H,A 0006| LCALL 043CH 0009| LCALL 0703H 000C| MOV R7,#01H 000E| LCALL 0647H 0011| MOV R3,#0FFH 0013| MOV R2,#02H 0015| MOV R1,#9CH 0017| LCALL 066FH 001A| MOV R7,#0C0H 001C| LCALL 0647H 001F| CLR A 0020| MOV R7,A 0021| LCALL 0622H 0024| MOV R7,#3AH 0026| LCALL 0622H 0029| MOV R7,#05H 002B| LCALL 03B9H 002E| MOV 21H,R7 0030| MOV 27H,#0FFH 0033| MOV 28H,#02H 0036| MOV 29H,#0ACH 0039| MOV 2AH,#05H 003C| MOV R3,#00H 003E| MOV R2,#00H 0040| MOV R1,#08H 0042| LCALL 05B5H 0045| JNC 05H 0047| LCALL 01D9H 004A| SJMP 0C0H 004C| MOV A,21H 004E| CJNE A,#01H,0BBH

0051| 0054| 0057| 005A| 005D| 005F| 0062| 0065| 0068| 006B| 006D| 006F| 0071| 0074| 0076| 0079| 007C| 007E| 0080| 0083| 0085| 0088| 008A| 008C| 008E| 0091| 0093| 0096| 0098| 009A| 009C| 009F| 00A1| 00A4| 00A6| 00A9| 00AB| 00AE| 00B0|

JNB 01H,0BH MOV 27H,#00H MOV 28H,#00H MOV 29H,#12H SJMP 09H MOV 27H,#0FFH MOV 28H,#05H MOV 29H,#6AH MOV 2AH,#05H MOV R3,#00H MOV R2,#00H MOV R1,#08H LCALL 05B5H MOV 02H,C JNB 02H,74H MOV 17H,#03H CLR 93H MOV R7,#01H LCALL 0647H MOV R7,#03H LCALL 0622H MOV R3,#0FFH MOV R2,#02H MOV R1,#0B2H LCALL 066FH MOV R7,#0C0H LCALL 0647H MOV R3,#0FFH MOV R2,#02H MOV R1,#0BBH LCALL 066FH MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H

00B3| 00B5| 00B8| 00BA| 00BC| 00BE| 00C1| 00C3| 00C6| 00C8| 00CA| 00CC| 00CF| 00D2| 00D5| 00D7| 00D9| 00DC| 00DE| 00E1| 00E3| 00E5| 00E7| 00EA| 00ED| 00EF| 00F1| 00F4| 00F6| 00F9| 00FB| 00FD| 00FF| 0102| 0104| 0107| 0109| 010B| 010D|

MOV R7,#01H LCALL 0647H MOV R3,#0FFH MOV R2,#02H MOV R1,#0C8H LCALL 066FH MOV R7,#0C0H LCALL 0647H MOV R3,#0FFH MOV R2,#02H MOV R1,#0D9H LCALL 066FH LCALL 04A8H CJNE R7,#0CH,0FAH SETB 93H MOV R7,#01H LCALL 0647H MOV R7,#03H LCALL 0622H MOV R3,#0FFH MOV R2,#02H MOV R1,#0E5H LCALL 066FH LJMP 000CH DEC 17H MOV R7,#01H LCALL 0647H MOV R7,#02H LCALL 0622H MOV R3,#0FFH MOV R2,#02H MOV R1,#0F5H LCALL 066FH MOV R7,#0C0H LCALL 0647H MOV R3,#0FFH MOV R2,#03H MOV R1,#02H LCALL 066FH

0110| 0112| 0114| 0115| 0118| 011A| 011D| 011F| 0122| 0124| 0127| 0129| 012C| 012E| 0130| 0133| 0135| 0138| 013A| 013D| 013F| 0141| 0143| 0146| 0148| 014B| 014D| 0150| 0151| 0152| 0155| 0157| 015A| 015C| 015F| 0161| 0164| 0167| 016A|

MOV A,17H ADD A,#30H MOV R7,A LCALL 0622H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV A,17H JZ 03H LJMP 000CH MOV R7,#01H LCALL 0647H MOV R7,#02H LCALL 0622H MOV R3,#0FFH MOV R2,#03H MOV R1,#10H LCALL 066FH MOV R7,#02H LCALL 0622H MOV R7,#0C0H LCALL 0647H CLR A MOV R7,A LCALL 0622H MOV R7,#3AH LCALL 0622H MOV R7,#0AH LCALL 03B9H MOV 21H,R7 MOV 27H,#0FFH MOV 28H,#05H MOV 29H,#60H MOV 2AH,#0AH

016D| 016F| 0171| 0173| 0176| 0178| 017B| 017D| 0180| 0182| 0185| 0187| 0189| 018B| 018E| 0190| 0193| 0195| 0198| 019A| 019D| 019F| 01A2| 01A4| 01A7| 01AA| 01AC| 01AF| 01B1| 01B4| 01B6| 01B8| 01BA| 01BD| 01BF| 01C2| 01C4| 01C7| 01C9|

MOV R3,#00H MOV R2,#00H MOV R1,#08H LCALL 05B5H JNC 32H MOV 17H,#03H MOV R7,#01H LCALL 0647H MOV R7,#02H LCALL 0622H MOV R3,#0FFH MOV R2,#03H MOV R1,#18H LCALL 066FH MOV R7,#02H LCALL 0622H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H LJMP 000CH MOV R7,#01H LCALL 0647H MOV R7,#02H LCALL 0622H MOV R3,#0FFH MOV R2,#03H MOV R1,#22H LCALL 066FH MOV R7,#02H LCALL 0622H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H

01CC| 01CE| 01D1| 01D3| 01D6| 01D9| 01DB| 01DE| 01E0| 01E3| 01E5| 01E7| 01E9| 01EC| 01EE| 01F1| 01F2| 01F3| 01F6| 01F8| 01FB| 01FD| 0200| 0202| 0204| 0206| 0208| 020B| 020E| 0211| 0214| 0217| 0218| 021A| 021C| 021F| 0221| 0223| 0226|

MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H LJMP 0133H MOV R7,#01H LCALL 0647H MOV R7,#80H LCALL 0647H MOV R3,#0FFH MOV R2,#05H MOV R1,#11H LCALL 066FH MOV R7,#0C0H LCALL 0647H CLR A MOV R7,A LCALL 0622H MOV R7,#3AH LCALL 0622H MOV R7,#0AH LCALL 03B9H MOV 23H,R7 MOV A,23H XRL A,#01H JZ 03H LJMP 0292H MOV 27H,#0FFH MOV 28H,#05H MOV 29H,#60H MOV 2AH,#0AH MOV R3,A MOV R2,#00H MOV R1,#08H LCALL 05B5H JNC 4FH MOV R7,#01H LCALL 0647H MOV R3,#0FFH

0228| 022A| 022C| 022F| 0231| 0234| 0235| 0236| 0239| 023B| 023E| 0240| 0243| 0245| 0247| 0249| 024B| 024D| 0250| 0252| 0255| 0257| 0259| 025B| 025E| 0260| 0263| 0265| 0267| 0269| 026B| 026D| 026F| 0270| 0272| 0275| 0277| 0279| 027B|

MOV R2,#05H MOV R1,#22H LCALL 066FH MOV R7,#0C0H LCALL 0647H CLR A MOV R7,A LCALL 0622H MOV R7,#3AH LCALL 0622H MOV R7,#05H LCALL 03B9H MOV 23H,R7 MOV A,23H XRL A,#01H JNZ 1AH MOV R7,#01H LCALL 0647H MOV R7,#03H LCALL 0622H MOV R3,#0FFH MOV R2,#05H MOV R1,#31H LCALL 066FH SETB 01H LCALL 06D1H SJMP 19H MOV A,23H XRL A,#02H JZ 0B6H MOV A,23H XRL A,#03H RET MOV R7,#01H LCALL 0647H MOV R3,#0FFH MOV R2,#05H MOV R1,#42H LCALL 066FH

027E| 0280| 0283| 0285| 0288| 028A| 028D| 028F| 0292| 0294| 0296| 0298| 029B| 029C| 029E| 02A0| 02A2| 02A3| 02A4| 02A7| 02AA| 02AC| 02AE| 02AF| 02B0| 02B2| 02B5| 02B8| 02B9| 02BA| 02BB| 02BD| 02BF| 02C1| 02C3| 02C5| 02C7| 02C8| 02CA|

MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LJMP 06E4H MOV A,23H XRL A,#02H JNZ 03H LJMP 01D9H RET ORL A,6EH MOV A,#65H ORL C,20H XRL A,R4 XRL A,R7 XRL 6BH,#20H XRL 6FH,#64H XRL A,00H ADDC A,34H RLC A RETI ACALL 100H JB 4CH,6FH XRL 6BH,#20H XRL A,R1 JMP @A+DPTR NOP XRL A,#65H AJMP 363H MOV A,#69H MOV @R0,#61H MOV A,#65H XRL A,#21H NOP JNC 72H XRL A,73H

02CC| 02CD| 02D0| 02D1| 02D4| 02D6| 02D8| 02D9| 02DA| 02DB| 02DE| 02E0| 02E2| 02E3| 02E5| 02E6| 02E7| 02EA| 02EB| 02EC| 02EF| 02F1| 02F3| 02F5| 02F8| 02F9| 02FA| 02FB| 02FE| 0300| 0302| 0304| 0305| 0307| 030A| 030B| 030D| 030E| 0311|

JMP @A+DPTR JB 27H,23H ADD A,@R1 JB 6BH,65H MOV R1,#20H MOV A,#6FH NOP XRL A,R4 XRL A,R7 XRL 6BH,#20H AJMP 367H AJMP 369H XRL A,R6 AJMP 100H ORL A,R4 XRL A,R7 XRL 6BH,#20H XRL A,R1 JMP @A+DPTR JB 61H,63H MOV A,#69H MOV @R0,#65H AJMP 100H JB 57H,72H XRL A,R7 XRL A,R6 XRL A,@R1 JB 43H,6FH XRL A,#65H AJMP 100H ANL A,#72H XRL A,R1 XRL A,73H JB 6CH,65H XRL A,@R0 MOV A,#20H ADDC A,R5 JB 00H,42H ORL A,R4

0312| 0313| 0316| 0318| 031A| 031C| 031D| 0320| 0322| 0323| 0325| 0326| 0327| 032A| 032C| 032D| 032F| 0330| 0331| 0333| 0336| 0339| 033C| 033D| 033E| 033F| 0340| 0341| 0342| 0343| 0345| 0346| 0348| 0349| 034A| 034C| 034E| 034F| 0350|

ORL A,R7 ORL 4BH,#45H ORL A,#00H ANL A,4EH ORL 4CH,A ORL A,R7 ORL 4BH,#45H ORL A,#00H ANL A,@R1 ANL 4FH,A ORL A,R6 ORL A,@R1 JB 43H,4FH ORL A,#45H NOP MOV R0,#7FH CLR A MOV @R0,A DJNZ R0,0FDH MOV 81H,#2AH LJMP 0374H LJMP 0003H CLR A MOVC A,@A+DPTR INC DPTR MOV R0,A CLR A MOVC A,@A+DPTR INC DPTR JC 03H MOV @R0,A SJMP 01H MOVX @R0,A INC R0 DJNZ R7,0F4H SJMP 29H CLR A MOVC A,@A+DPTR INC DPTR

0351| 0352| 0354| 0356| 0357| 0358| 0359| 035A| 035C| 035E| 035F| 0360| 0362| 0363| 0364| 0366| 0367| 0368| 036A| 036C| 036E| 036F| 0370| 0373| 0375| 0376| 0377| 0378| 037A| 037B| 037D| 037E| 037F| 0381| 0384| 0386| 0387| 0388| 0389|

MOV R0,A ANL A,#07H ADD A,#0CH XCH A,R0 CLR C RLC A SWAP A ANL A,#0FH ORL A,#20H XCH A,R0 MOVC A,@A+PC JC 04H CPL A ANL A,@R0 SJMP 01H ORL A,@R0 MOV @R0,A DJNZ R7,0E4H SJMP 0BH AJMP 002H INC A INC R0 JBC 20H,40H SJMP 90H INC @R0 CPL A CLR A MOV R6,#01H MOVC A,@A+DPTR JZ 0BCH INC DPTR MOV R7,A ANL A,#3FH JNB 0E5H,09H ANL A,#1FH MOV R6,A CLR A MOVC A,@A+DPTR INC DPTR

038A| 038C| 038D| 038E| 0390| 0392| 0394| 0396| 0397| 0398| 0399| 039A| 039B| 039C| 039D| 039E| 039F| 03A0| 03A1| 03A2| 03A4| 03A5| 03A6| 03A8| 03A9| 03AA| 03AB| 03AC| 03AE| 03AF| 03B0| 03B2| 03B3| 03B5| 03B7| 03B9| 03BB| 03BC| 03BE|

JZ 01H INC R6 XCH A,R7 ANL A,#0C0H ADD A,0E0H JZ 0A8H JC 0B8H CLR A MOVC A,@A+DPTR INC DPTR MOV R2,A CLR A MOVC A,@A+DPTR INC DPTR MOV R0,A CLR A MOVC A,@A+DPTR INC DPTR XCH A,R0 XCH A,82H XCH A,R0 XCH A,R2 XCH A,83H XCH A,R2 MOVX @DPTR,A INC DPTR XCH A,R0 XCH A,82H XCH A,R0 XCH A,R2 XCH A,83H XCH A,R2 DJNZ R7,0E9H DJNZ R6,0E7H SJMP 0BEH MOV 24H,R7 CLR A MOV 25H,A LCALL 04A8H

03C1| 03C3| 03C4| 03C6| 03C8| 03CB| 03CD| 03CF| 03D1| 03D2| 03D4| 03D6| 03D8| 03DA| 03DC| 03DE| 03E0| 03E1| 03E3| 03E5| 03E7| 03E8| 03EB| 03ED| 03F0| 03F2| 03F4| 03F5| 03F8| 03FA| 03FC| 03FF| 0401| 0402| 0404| 0406| 0407| 0409| 040B|

MOV 26H,R7 MOV A,R7 JZ 0F8H MOV R7,26H LCALL 06B4H MOV 26H,R7 MOV A,#08H ADD A,25H MOV R0,A MOV @R0,26H MOV A,26H XRL A,#78H JNZ 20H MOV A,25H JNZ 03H MOV R7,#03H RET DEC 25H MOV A,25H ADD A,#0C2H MOV R7,A LCALL 0647H MOV R7,#20H LCALL 0622H MOV A,25H ADD A,#0C2H MOV R7,A LCALL 0647H SJMP 0C4H MOV A,26H CJNE A,#65H,03H MOV R7,#01H RET INC 25H MOV A,25H SETB C SUBB A,24H JC 2AH MOV R7,#01H

040D| 0410| 0412| 0415| 0417| 0419| 041B| 041E| 0420| 0423| 0425| 0428| 042A| 042D| 042F| 0432| 0434| 0435| 0437| 043A| 043C| 043F| 0441| 0444| 0446| 0449| 044B| 044E| 0450| 0453| 0454| 0456| 0459| 045C| 045E| 0460| 0461| 0463| 0465|

LCALL 0647H MOV R7,#02H LCALL 0622H MOV R3,#0FFH MOV R2,#05H MOV R1,#4EH LCALL 066FH MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#0FAH LCALL 06E4H MOV R7,#02H RET MOV R7,26H LCALL 0622H SJMP 82H LCALL 05EAH MOV R7,#28H LCALL 0647H MOV R7,#0CH LCALL 0647H MOV R7,#06H LCALL 0647H MOV R7,#40H LCALL 0647H CLR A MOV 23H,A MOV DPTR, #0694H LCALL 061EH INC 23H MOV A,23H CLR C SUBB A,#08H JC 0F1H CLR A

0466| 0468| 046B| 046E| 0470| 0472| 0473| 0475| 0477| 0478| 047A| 047C| 047F| 0480| 0481| 0484| 0486| 0488| 0489| 048B| 048D| 048E| 0490| 0492| 0495| 0496| 0497| 049A| 049C| 049E| 049F| 04A1| 04A3| 04A5| 04A8| 04A9| 04AB| 04AE| 04B0|

MOV 23H,A MOV DPTR, #069CH LCALL 061EH INC 23H MOV A,23H CLR C SUBB A,#08H JC 0F1H CLR A MOV 23H,A MOV A,23H MOV DPTR, #06A4H MOVC A,@A+DPTR MOV R7,A LCALL 0622H INC 23H MOV A,23H CLR C SUBB A,#08H JC 0EDH CLR A MOV 23H,A MOV A,23H MOV DPTR, #06ACH MOVC A,@A+DPTR MOV R7,A LCALL 0622H INC 23H MOV A,23H CLR C SUBB A,#08H JC 0EDH MOV R7,#80H LJMP 0647H CLR A MOV 2AH,A MOV 29H,#01H MOV 27H,A MOV R7,27H

04B2| 04B4| 04B6| 04B7| 04B9| 04BA| 04BB| 04BD| 04BE| 04BF| 04C1| 04C3| 04C6| 04C7| 04C9| 04CA| 04CC| 04CF| 04D2| 04D5| 04D7| 04D8| 04DB| 04DD| 04DE| 04E0| 04E3| 04E5| 04E6| 04E9| 04EB| 04ED| 04EF| 04F2| 04F4| 04F5| 04F7| 04F9| 04FB|

MOV A,#80H MOV R0,07H INC R0 SJMP 02H CLR C RRC A DJNZ R0,0FCH MOV R6,A CPL A ANL 90H,A MOV R7,90H ANL 07H,#07H CLR C MOV A,#07H SUBB A,R7 JZ 2BH JB 90H,09H MOV 2AH,29H JNB 90H,0FDH MOV R7,2AH RET JB 91H,0BH MOV A,29H INC A MOV 2AH,A JNB 91H,0FDH MOV R7,2AH RET JB 92H,0CH MOV A,29H ADD A,#02H MOV 2AH,A JNB 92H,0FDH MOV R7,2AH RET INC 28H MOV A,#03H ADD A,29H MOV 29H,A

04FD| 04FE| 0500| 0502| 0505| 0507| 0509| 050A| 050C| 050E| 0510| 0511| 0513| 0515| 0517| 0518| 051A| 051C| 051E| 051F| 0521| 0522| 0524| 0526| 0528| 0529| 052B| 052E| 0530| 0531| 0532| 0533| 0536| 0539| 053B| 053C| 053E| 0540| 0542|

MOV A,R6 ORL 90H,A MOV R7,#0AH LCALL 06E4H INC 27H MOV A,27H CLR C SUBB A,#04H JC 0A2H MOV R7,#00H RET ORL A,6EH MOV A,#65H ORL C,20H ORL A,R5 AJMP 373H MOV A,#65H ORL C,63H XRL A,R7 XRL A,#65H NOP ORL A,6EH MOV A,#65H ORL C,20H XRL A,R6 XRL A,77H JB 63H,6FH XRL A,#65H NOP XRL A,R4 XRL A,R7 XRL 6BH,#20H XRL 6FH,#64H XRL A,20H JMP @A+DPTR AJMP 376H XRL A,64H AJMP 100H ANL A,@R1

0543| 0545| 0546| 0547| 054A| 054C| 054E| 0551| 0553| 0556| 0557| 055A| 055B| 055C| 055D| 055E| 055F| 0560| 0561| 0562| 0563| 0564| 0565| 0566| 0568| 0569| 056B| 056C| 056D| 056F| 0572| 0574| 0576| 0577| 0578| 057A| 057B| 057C| 057F|

ANL 4FH,A ORL A,R6 ORL A,@R1 JB 43H,4FH ORL A,#45H AJMP 100H JB 43H,6FH XRL A,#65H JB 74H,6FH XRL A,R7 JB 4CH,6FH XRL A,R6 XRL A,@R1 ADD A,R6 ADD A,R6 ADD A,R6 NOP ADDC A,R0 ADDC A,@R1 ADDC A,@R1 ADDC A,@R0 ADDC A,R1 RLC A ADDC A,#32H ADDC A,@R0 ADDC A,35H ADDC A,@R0 ADDC A,@R1 ACALL 132H CJNE R3,#01H,06H MOV 82H,R1 MOV 83H,R2 MOVX A,@DPTR RET JNC 02H MOV A,@R1 RET CJNE R3,#0FEH,02H MOVX A,@R1

0580| 0581| 0583| 0585| 0586| 0587| 0588| 058B| 058D| 058E| 0590| 0592| 0593| 0595| 0596| 0597| 0599| 059A| 059C| 059D| 059E| 059F| 05A2| 05A3| 05A5| 05A6| 05A7| 05A8| 05AA| 05AB| 05AD| 05AF| 05B0| 05B2| 05B3| 05B4| 05B5| 05B7| 05B9|

RET MOV 82H,R1 MOV 83H,R2 CLR A MOVC A,@A+DPTR RET CJNE R3,#01H,0CH MOV A,82H ADD A,R1 MOV 82H,A MOV A,83H ADDC A,R2 MOV 83H,A MOVX A,@DPTR RET JNC 06H MOV A,R1 ADD A,82H MOV R0,A MOV A,@R0 RET CJNE R3,#0FEH,06H MOV A,R1 ADD A,82H MOV R0,A MOVX A,@R0 RET MOV A,82H ADD A,R1 MOV 82H,A MOV A,83H ADDC A,R2 MOV 83H,A CLR A MOVC A,@A+DPTR RET MOV 24H,R3 MOV 25H,R2 MOV 26H,R1

05BB| 05BC| 05BD| 05BE| 05BF| 05C1| 05C3| 05C5| 05C7| 05C9| 05CB| 05CE| 05D1| 05D2| 05D4| 05D6| 05D8| 05DA| 05DD| 05E0| 05E1| 05E3| 05E4| 05E5| 05E6| 05E8| 05E9| 05EA| 05ED| 05EF| 05F2| 05F5| 05F8| 05FA| 05FD| 0600| 0603| 0605| 0608|

CLR A MOV R7,A MOV A,R7 CLR C SUBB A,2AH JNC 25H MOV R3,27H MOV R2,28H MOV R1,29H MOV 82H,R7 MOV 83H,#00H LCALL 0588H MOV R6,A MOV R3,24H MOV R2,25H MOV R1,26H MOV 82H,R7 MOV 83H,#00H LCALL 0588H XRL A,R6 JZ 02H CLR C RET INC R7 SJMP 0D5H SETB C RET MOV 0B0H,#0FFH MOV R7,#14H LCALL 06E4H MOV 0B0H,#83H MOV 0B0H,#03H MOV R7,#0AH LCALL 06E4H MOV 0B0H,#83H MOV 0B0H,#03H MOV R7,#01H LCALL 06E4H MOV 0B0H,#83H

060B| 060E| 0610| 0613| 0616| 0619| 061B| 061E| 0620| 0621| 0622| 0623| 0624| 0626| 0627| 0629| 062B| 062C| 062E| 0630| 0631| 0633| 0634| 0636| 0638| 0639| 063B| 063D| 063F| 0642| 0644| 0647| 0648| 064A| 064C| 064D| 064F| 0650| 0652|

MOV 0B0H,#03H MOV R7,#01H LCALL 06E4H MOV 0B0H,#82H MOV 0B0H,#02H MOV R7,#01H LJMP 06E4H MOV A,23H MOVC A,@A+DPTR MOV R7,A MOV A,R7 SWAP A ANL A,#0FH MOV R6,A ORL A,#0A0H MOV 0B0H,A MOV A,R6 ORL A,#20H MOV 0B0H,A MOV A,R7 ANL A,#0FH MOV R6,A ORL A,#0A0H MOV 0B0H,A MOV A,R6 ORL A,#20H MOV 0B0H,A MOV R7,#0C8H LCALL 06FCH MOV R7,#0C8H LJMP 06FCH MOV A,R7 MOV R0,#04H MOV C,0E7H RRC A DJNZ R0,0FBH MOV R6,A ANL A,#0FH ORL A,#80H

0654| 0656| 0657| 0659| 065B| 065C| 065E| 065F| 0661| 0663| 0665| 0667| 066A| 066C| 066F| 0671| 0673| 0675| 0677| 0679| 067B| 067E| 0680| 0682| 0684| 0686| 0688| 0689| 068A| 068D| 068E| 0691| 0693| 0694| 0695| 0696| 0697| 0698| 0699|

MOV 0B0H,A MOV A,R6 ANL A,#0FH MOV 0B0H,A MOV A,R7 ANL A,#0FH MOV R6,A ORL A,#80H MOV 0B0H,A MOV 0B0H,R6 MOV R7,#0C8H LCALL 06FCH MOV R7,#0C8H LJMP 06FCH MOV 27H,R3 MOV 28H,R2 MOV 29H,R1 MOV R3,27H MOV R2,28H MOV R1,29H LCALL 056FH JZ 13H INC 29H MOV A,29H JNZ 02H INC 28H DEC A MOV R1,A LCALL 056FH MOV R7,A LCALL 0622H SJMP 0E2H RET INC R6 INC R2 DEC R7 DEC R7 DEC R3 DEC R3

069A| 069B| 069C| 069D| 06A0| 06A1| 06A2| 06A3| 06A4| 06A5| 06A6| 06A7| 06A8| 06A9| 06AA| 06AB| 06AC| 06AD| 06AF| 06B0| 06B1| 06B2| 06B3| 06B4| 06B5| 06B6| 06B8| 06BA| 06BB| 06BD| 06BE| 06BF| 06C2| 06C4| 06C5| 06C8| 06CA| 06CB| 06CE|

INC R6 NOP INC R6 LJMP 1F1FH DEC R3 DEC R3 INC R6 NOP DEC R7 DEC R3 DEC R3 DEC R3 DEC R3 DEC R7 DEC R3 DEC R7 NOP AJMP 003H DEC @R0 DEC R4 INC R0 NOP NOP MOV A,R7 CLR C SUBB A,#0AH JNC 05H MOV A,R7 ADD A,#30H MOV R7,A RET CJNE R7,#0AH,03H MOV R7,#78H RET CJNE R7,#0BH,03H MOV R7,#30H RET CJNE R7,#0CH,02H MOV R7,#65H

06D0| 06D1| 06D2| 06D3| 06D5| 06D6| 06D7| 06D8| 06D9| 06DB| 06DC| 06DD| 06DF| 06E0| 06E3| 06E4| 06E6| 06E8| 06E9| 06EA| 06EC| 06EE| 06F1| 06F3| 06F4| 06F6| 06F8| 06FA| 06FB| 06FC| 06FE| 06FF| 0700| 0702| 0703| 0706| END

RET CLR A MOV R7,A MOV A,#08H ADD A,R7 MOV R0,A MOV A,@R0 MOV R6,A MOV A,#12H ADD A,R7 MOV R0,A MOV @R0,06H INC R7 CJNE R7,#05H,0F0H RET MOV R5,07H MOV R7,05H DEC R5 MOV A,R7 JZ 07H MOV R7,#95H LCALL 06FCH SJMP 0F3H RET AJMP 600H AJMP 601H AJMP 017H RR A NOP MOV R6,07H DEC R7 MOV A,R6 JNZ 0FAH RET ANL 90H,#0FH RET

REFERENCES
1. http://kitsnspares.com/admin/pdffiles/Microcontroller%20based %20Code%20Look.pdf 2. http://www.atmel.com/Images/doc0368.pdf 3. http://efymag.com 4. http://www.hbcc.edu.sa/facpages/kt/embedded/kt_Hex%20Keyp ad%20Scanning%20and%20Interfacing.pdf 5. http://www.engineersgarage.com/electronic-components/16x2lcd-module-datasheet 6. http://www.engineersgarage.com/electronic-components/74ls04datasheet 7. http://www.engineersgarage.com/electronic-components/l293dmotor-driver-ic 8. The 8051 microcontroller and embedded systems by Muhammad Ali Mazidi,Janice Gillispie Mazidi,Rolin D. McKinlay

S-ar putea să vă placă și