8 May 2013

SYSTEM DESIGN USING MICROCONTROLLER OF SECURITY SYSTEMS COMBINATION LOCK

Here you learn how we can design a system using microcontroller of security systems combination lock.

PROCEDURE:

1. Read number of bytes in the password
2. Initialize the password
3. Initialize the Keyboard Display IC (8279) to get key and Display
4. Blank the display
5. Read the key from user
6. Compare with the initialized password
7. If it is not equal, Display ‘E’ to indicate Error.
8. Repeat the steps 6 and 7 to read next key
9. If entered password equal to initialized password, Display ‘O’ to indicate open.


PROGRAM:


MOV 51H,#
MOV 52H,#
MOV 53H,#
MOV 54H,#
MOV R1,#51
MOV R0,#50
MOV R3,#04
MOV R2,#08
MOV DPTR,#FFC2
MOV A,#00

MOVX @DPTR,A
MOV A,#CC
MOVX @DPTR,A
MOV A,#90
MOVX @DPTR,A
MOV A,#FF
MOV DPTR,#FFCO
LOOP: MOVX @DPTR,A
DJNZ R2,LOOP
AGAIN: MOV DPTR,#FFC2
WAIT: MOVX A,@DPTR
ANL A,#07
JZ WAIT
MOV A,#40
MOVX @DPTR,A
MOV DPTR,#FFCO
MOVX A,@DPTR
MOV @R0,A
MOV A,@R1
CJNE A,50H,NEQ
INC R1
DJNZ R3,AGAIN
MOV DPTR,#FFCO
MOV A,#OC
MOVX @DPTR,A
XX: SJMP XX
NEQ: MOV DPTR,#FFCO
MOV A,#68
MOVX @DPTR,A
YY: SJMP YY

PROGRAMMING 8051 USING KEIL SOFTWARE

Here you find process and programing of 8051 using keil software

PROCEDURE:

1. Click KeilRVision2 icon in the desktop
2. From Project Menu open New project
3. Select the target device as ATMEL 89C51
4. From File Menu open New File
5. Type the program in Text Editor
6. Save the file with extension “.asm”
7. In project window click the tree showing TARGET
8. A source group will open.
9. Right Click the Source group and click “Add files to Source group”
10. A new window will open. Select our file with extension “.asm”
11. Click Add.
12. Go to project window and right click Source group again
13. Click Build Target (F7).
14. Errors if any will be displayed.
15. From Debug menu, select START/STOP Debug option.
16. In project window the status of all the registers will be displayed.
17. Click Go from Debug Menu.
18. The results stored in registers will be displayed in Project window.
19. Stop the Debug process before closing the application.


PROGRAM:

ORG 4100
CLR C
MOV A,#05H
MOV B,#02H
DIV AB

ALP For INTERFACING STEPPER MOTOR WITH 8051


Hi Friend here i am written ALP For INTERFACING STEPPER MOTOR WITH 8051

THEORY:
 
A motor in which the rotor is able to assume only discrete stationary angular position is a stepper motor. The rotor motion occurs in a stepwise manner from one equilibrium position to next.


The motor under our consideration uses 2 – phase scheme of operation. In this scheme, any two adjacent stator windings are energized. The switching condition for the above said scheme is shown in Table.












ALGORITHM:

1. Store the look up table address in DPTR
2. Move the count value (04) to one of the register (R0)
3. Load the control word for motor rotation in accumulator
4. Push the address in DPTR into stack
5. Load FFC0 in to DPTR.
6. Call the delay program
7. Send the control word for motor rotation to the external device.
8. Pop up the values in stack and increment it.
9. Decrement the count in R0. If zero go to next step else proceed to step 3.
10. Perform steps 1 to 9 repeatedly.


PROGRAM:


ORG 4100
START: MOV DPTR,#4500H
MOV R0,#04
AGAIN: MOVX A,@DPTR
PUSH DPH
PUSH PDL
MOV DPTR,#FFC0H
MOV R2, 04H
MOV R1,#FFH
DLY1: MOV R3, #FFH
DLY: DJNZ R3,DLY
DJNZ R1,DLY1
DJNZ R2,DLY1
MOVX @DPTR,A
POP DPL
POP DPH
INC DPTR
DJNZ R0,AGAIN
SJMP START

INTERFACING 8279 KEYBOARD/DISPLAY CONTROLLER WITH 8085 MICROPROCESSOR


Hi Friend here i am written INTERFACING 8279 KEYBOARD/DISPLAY CONTROLLER WITH 8085 MICROPROCESSOR

PROGRAM                                                               Comment

START: LXI H,4130H
MVI D,0FH ;                                                         Initialize counter.
MVI A,10H
OUT C2H ;                                                           Set Mode and Display.
MVI A,CCH ;                                                       Clear display.
OUT C2H
MVI A,90H ;                                                         Write Display
OUT C2H
LOOP: MOV A,M
OUT C0H
CALL DELAY
INX H
DCR D
JNZ LOOP
JMP START
DELAY: MVI B, A0H
LOOP2: MVI C, FFH
LOOP1: DCR C
JNZ LOOP1
DCR B
JNZ LOOP2
RET

ALP FOR INTERFACING DAC WITH 8085


Hi Friend here i am written ALP FOR INTERFACING DAC WITH 8085

ALGORITHM:

(a) Square Wave Generation
1. Load the initial value (00) to Accumulator and move it to DAC
2. Call the delay program
3. Load the final value(FF) to accumulator and move it to DAC
4. Call the delay program.
5. Repeat Steps 2 to 5


(b) Saw tooth Wave Generation
1. Load the initial value (00) to Accumulator
2. Move the accumulator content to DAC
3. Increment the accumulator content by 1.
4. Repeat Steps 3 and 4.


(c) Triangular Wave Generation
2. Load the initial value (00) to Accumulator
3. Move the accumulator content to DAC
4. Increment the accumulator content by 1.
5. If accumulator content is zero proceed to next step. Else go to step 3.
6. Load value (FF) to Accumulator
7. Move the accumulator content to DAC
8. Decrement the accumulator content by 1.
9. If accumulator content is zero go to step2. Else go to step 7.


Programing 

(a) Square Wave Generation

START: MVI A,00
OUT Port address of DAC
CALL DELAY
MVI A,FF
OUT Port address of DAC
CALL DELAY
JMP START
DELAY: MVI B,05
L1: MVI C,FF
L2: DCR C
JNZ L2
DCR B
JNZ L1
RET


(b) Saw tooth Wave Generation


START: MVI A,00
L1: OUT Port address of DAC
INR A
JNZ L1
JMP START


(c) Triangular Wave Generation

START: MVI L,00
L1: MOV A,L
OUT Port address of DAC
INR L
JNZ L1
MVI L,FF
L2: MOV A,L
OUT Port address of DAC
DCR L
JNZ L2
JMP START

ALP FOR INTERFACING ADC WITH 8085 PROCESSOR


Hi Friend here i am written ALP FOR INTERFACING ADC WITH 8085 PROCESSOR

PROGRAM:

MVI A,10
OUT C8
MVI A,18
OUT C8
MVI A,10
OUT D0
XRA A
XRA A
XRA A
MVI A,00
OUT D0
LOOP: IN D8
ANI 01
CPI 01
JNZ LOOP
IN C0
STA 4150
HLT


OBSERVATION:

Compare the data displayed at the LEDs with that stored at location 4150


RESULT:
Thus the ADC was initiated and the digital data was stored at desired location

ALP of 8085 FOR HEX TO BCD CONVERSION


Hi Friend here i am written ALP of 8085 FOR HEX TO BCD CONVERSION

ALGORITHM:

1) Initialize memory pointer to 4150 H
2) Get the Hexa decimal number in C - register
3) Perform repeated addition for C number of times
4) Adjust for BCD in each step
5) Store the BCD data in Memory



PROGRAM:


LXI H,4150                          Initialize memory pointer
MVI D,00                              Clear D- reg for Most significant Byte
XRA A                                    Clear Accumulator
MOV C,M                              Get HEX data
LOOP2: ADI 01                  Count the number one by one
DAA                                        Adjust for BCD count
JNC LOOP1
INR D
LOOP1: DCR C
JNZ LOOP2
STA 4151                              Store the Least Significant Byte
MOV A,D
STA 4152                             Store the Most Significant Byte
HLT

ALP OF BCD TO HEX CONVERSION

Hi Friend here i am written ALP For BCD TO HEX CONVERSION

ALGORITHM:

1) Initialize memory pointer to 4150 H
2) Get the Most Significant Digit (MSD)
3) Multiply the MSD by ten using repeated addition
4) Add the Least Significant Digit (LSD) to the result obtained in previous step
5) Store the HEX data in Memory



PROGRAM:


LXI H,4150
MOV A,M Initialize memory pointer
ADD A MSD X 2
MOV B,A Store MSD X 2
ADD A MSD X 4
ADD A MSD X 8
ADD B MSD X 10
INX H Point to LSD
ADD M Add to form HEX
INX H
MOV M,A Store the result
HLT

ALP For ARRANGE AN ARRAY OF DATA IN DESCENDING ORDER

Hi Friend here i am written ALP For ARRANGE AN ARRAY OF DATA IN DESCENDING ORDER


ALGORITHM:

1. Initialize HL pair as memory pointer
2. Get the count at 4200 into C – register
3. Copy it in D – register (for bubble sort (N-1) times required)
4. Get the first value in A – register
5. Compare it with the value at next location.
6. If they are out of order, exchange the contents of A –register and Memory
7. Decrement D –register content by 1
8. Repeat steps 5 and 7 till the value in D- register become zero
9. Decrement C –register content by 1
10. Repeat steps 3 to 9 till the value in C – register becomes zero


PROGRAM:


LXI H,4200
MOV C,M
DCR C
REPEAT: MOV D,C
LXI H,4201
LOOP: MOV A,M
INX H
CMP M
JNC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT

ARRANGE AN ARRAY OF DATA IN ASCENDING ORDER

Hi Friend here i am written ALP For ARRANGE AN ARRAY OF DATA IN ASCENDING ORDER

ALGORITHM:

1. Initialize HL pair as memory pointer
2. Get the count at 4200 into C – register
3. Copy it in D – register (for bubble sort (N-1) times required)
4. Get the first value in A – register
5. Compare it with the value at next location.
6. If they are out of order, exchange the contents of A –register and Memory
7. Decrement D –register content by 1
8. Repeat steps 5 and 7 till the value in D- register become zero
9. Decrement C –register content by 1
10. Repeat steps 3 to 9 till the value in C – register becomes zero


PROGRAM:

LXI H,4200
MOV C,M
DCR C
REPEAT: MOV D,C
LXI H,4201
LOOP: MOV A,M
INX H
CMP M
JC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT

SMALLEST NUMBER IN AN ARRAY OF DATA

Hi Friend here i am written ALP For SMALLEST NUMBER IN AN ARRAY OF DATA

ALGORITHM:

1) Load the address of the first element of the array in HL pair
2) Move the count to B – reg.
3) Increment the pointer
4) Get the first data in A – reg.
5) Decrement the count.
6) Increment the pointer
7) Compare the content of memory addressed by HL pair with that of A - reg.
8) If carry = 1, go to step 10 or if Carry = 0 go to step 9
9) Move the content of memory addressed by HL to A – reg.
10) Decrement the count
11) Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to next step.
12) Store the smallest data in memory.
13) Terminate the program.



PROGRAM                            COMMENT


LXI H,4200                        Set pointer for array
MOV B,M                             Load the Count
INX H
MOV A,M                             Set 1st element as largest data
DCR B                                   Decrement the count
LOOP: INX H
CMP M                                  If A- reg < M go to AHEAD
JC AHEAD
MOV A,M                             Set the new value as smallest
AHEAD: DCR B
JNZ LOOP                           Repeat comparisons till count = 0
STA 4300                             Store the largest value at 4300
HLT

LARGEST NUMBER IN AN ARRAY OF DATA

Hi Friend here i am written ALP For LARGEST NUMBER IN AN ARRAY OF DATA

ALGORITHM:

1) Load the address of the first element of the array in HL pair
2) Move the count to B – reg.
3) Increment the pointer
4) Get the first data in A – reg.
5) Decrement the count.
6) Increment the pointer
7) Compare the content of memory addressed by HL pair with that of A - reg.
8) If Carry = 0, go to step 10 or if Carry = 1 go to step 9
9) Move the content of memory addressed by HL to A – reg.
10) Decrement the count
11) Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to next step.
12) Store the largest data in memory.
13) Terminate the program.


PROGRAM                       COMMENT


LXI H,4200                  Set pointer for array
MOV B,M                      Load the Count
INX H
MOV A,M                     Set 1st element as largest data
DCR B                           Decrement the count
LOOP: INX H
CMP M                          If A- reg > M go to AHEAD
JNC AHEAD
MOV A,M                    Set the new value as largest
AHEAD: DCR B
JNZ LOOP                  Repeat comparisons till count = 0
STA 4300                   Store the largest value at 4300
HLT

DIVISION OF TWO 8 BIT NUMBERS

Hi Friend here i am written ALP For DIVISION OF TWO 8 BIT NUMBERS

ALGORITHM:

1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register(B register).
3) Get the second data and load into Accumulator.
4) Compare the two numbers to check for carry.
5) Subtract the two numbers.
6) Increment the value of carry .
7) Check whether repeated subtraction is over and store the value of product and
carry in memory location.
8) Terminate the program.


PROGRAM                                          COMMENT


LXI H, 4150
MOV B, M                                        Get the dividend in B – reg.
MVI C, 00                                         Clear C – reg for qoutient
INX H
MOV A, M                                        Get the divisor in A – reg.
NEXT: CMP B                                   Compare A - reg with register B.
JC LOOP                                           Jump on carry to LOOP
SUB B                                                Subtract A – reg from B- reg.
INR C                                                 Increment content of register C.
JMP NEXT                                         Jump to NEXT
LOOP: STA 4152                               Store the remainder in Memory
MOV A, C
STA 4153                                           Store the quotient in memory
HLT                                                    Terminate the program.

MULTIPLICATION OF TWO 8 BIT NUMBERS



Hi Friend here i am written ALP For   MULTIPLICATION OF TWO 8 BIT NUMBERS
 
 
Algorithm
  1.  Start the program by loading HL register pair with address of memory location.
  2.    Move the data to a register (B register).
  3.    Get the second data and load into Accumulator.
  4.    Add the two register contents.
  5.    Check for carry.
  6.    Increment the value of carry.
  7.    Check whether repeated addition is over and store the value of product and carry
  8.    in memory location.
  9.    Terminate the program.
Programm                                 Comment 

MVI D, 00                             Initialize register D to 00
MVI A, 00                             Initialize Accumulator content to 00
LXI H, 4150
MOV B, M                           Get the first number in B - reg
INX H
MOV C, M                           Get the second number in C- reg.
LOOP: ADD B                     Add content of A - reg to register B.
JNC NEXT                          Jump on no carry to NEXT.
INR D                                  Increment content of register D
NEXT: DCR C                     Decrement content of register C.
JNZ LOOP                          Jump on no zero to address
STA 4152                            Store the result in Memory
MOV A, D
STA 4153                            Store the MSB of result in Memory
HLT                                     Terminate the program.