Professional Documents
Culture Documents
SWATHI
Date: /09/2022
Creating Project:
3. Go to project ->click on new uVision project -> create a new folder saved with experiment
number within the already existed register number folder in D drive mentioned in step 1, ->
enter the project name -> click on save.
4. Select the device for target -> In devices ->Enter P89C51RD2XX in Search toolbar -> click on ok
-> select No for dialog box message “Copy STARTUP.A51 to project folder and add files to
project”.
(or)
Choose NXP -> to select the device P89C51RD2XX -> click on ok -> select No for Copy
STARTUP.A51 to project folder.
a)
b)
PROGRAM:
a)
0011 A4 MUL AB
0019 84 DIV AB
001E 04 INC A
0021 14 DEC A
END
b)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0006 A4 MUL AB
END
c)
d)
Date: /10/2022
1(B). BASIC LOGICAL INSTRUCTIONS
AIM: Write a following assembly language programs (ALP) using logical instructions in 8051
Micro Controller.
a) Basic logical Operations
b) Packed BCD to ASCII Conversion
c) ASCII to Packed BCD Conversion
d) Counting the number of ones in Hexadecimal Number
TOOLS REQUIRED: PC, Keil µvision5
PROCEDURE:
1. Turn on the computer, create a folder on D drive saved with Register Number.
2. Open Keil uVision5 in desktop, or windows start menu -> all programs->open Keil uVision5.
Creating Project:
3. Go to project ->click on new uVision project -> create a new folder saved with experiment
number within the already existed register number folder in D drive mentioned in step 1, ->
enter the project name -> click on save.
4. Select the device for target -> In devices ->Enter P89C51RD2XX in Search toolbar -> click on ok
-> select No for dialog box message “Copy STARTUP.A51 to project folder and add files to
project”.
(or)
Choose NXP -> to select the device P89C51RD2XX -> click on ok -> select No for Copy
STARTUP.A51 to project folder.
PROGRAMS:
a)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 7867 MOV R0,#18H
0002 58 ANL A,R0
0003 F520 MOV 40H,A
0005 7445 MOV A,#45H
0007 48 ORL A,R0
0008 F521 MOV 41H,A
000A 7404 MOV A,#04H
000C 7445 MOV A,#45H
000E 68 XRL A,R0
000F F522 MOV 42H,A
0011 7416 MOV A,#16H
0013 F4 CPL A
0014 F523 MOV 43H,A
0016 C4 SWAP A
0017 F524 MOV 44H,A
0019 7404 MOV A,#04H
001B 03 RR A
001C F525 MOV 45H,A
001E 23 RL A
001F F526 MOV 46H,A
END
b)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 ORG 00H
0000 7840 MOV R0,340H
0002 E6 MOV A,@R0
0003 54F0 ANL A,#0F0H
0005 C4 SWAP A
0006 2430 ADD A,#20H
0008 F541 MOV 21H,A
000A E6 MOV A,@R0
000B 540F ANL A,#0FH
000D 2430 ADD A,#20H
000F F542 MOV 22H,A
END
c)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 ORG 00H
0000 7840 MOV R0,#40H
0002 E6 MOV A,@R0
0003 540F ANL A,#0FH
0005 C4 SWAP A
0006 F9 MOV R1,A
0007 08 INC R0
0008 E6 MOV A,@R0
0009 540F ANL A,#0FH
000B 29 ADD A,R1
000C 08 INC R0
000D F6 MOV @R0,A
END
d)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 ORG 00H
0000 7808 MOV R0,#09H
0002 7900 MOV R1,#00H
0004 749F MOV A,#5DH
0006 C3 L1 CLR C
0007 33 RLC A
0008 5001 JNC L2
000A 09 INC R1
000B D8F9 L2 DJNZ R0,L1
000D 8940 MOV 30H,R1
END
Date: /10/2022
Creating Project:
3. Go to project ->click on new uVision project -> create a new folder saved with experiment
number within the already existed register number folder in D drive mentioned in step 1, ->
enter the project name -> click on save.
4. Select the device for target -> In devices ->Enter P89C51RD2XX in Search toolbar -> click on ok
-> select No for dialog box message “Copy STARTUP.A51 to project folder and add files to
project”.
(or)
Choose NXP -> to select the device P89C51RD2XX -> click on ok -> select No for Copy
STARTUP.A51 to project folder.
CALCULATIONS:
a) TIMER 0 MODE 1, 1SEC TIME DELAY
THEORY:
Both timers 0 and 1 use the same register, called TMOD (timer mode), to set the various
timer operation modes
TMOD is 8-bit register
The lower 4 bits are for Timer 0
The upper 4 bits are for Timer 1
In each case
The lower 2 bits are used to set the timer mode
The upper 2 bits to specify the operation
PROGRAMS:
a)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 ORG 00H
0000 758901 MOV TMOD,#01H
0003 7455 MOV A,#55H
0005 90FFC0 MOV DPTR,#0FFC0H
0008 1110 L2 ACALL DELAY
000A F0 MOVX @DPTR,A
000B F5A0 MOV P2,A
000D F4 CPL A
000E 80F8 SJMP L2
0010 780E DELAY MOV R0,#0EH
0012 758A00 L1 MOV TL0,#00H
0015 758C00 MOV TH0,#00H
0018 D28C SETB TR0
001A 308DFD HERE JNB TF0, HERE
001D C28D CLR TF0
001F C28C CLR TR0
0021 D8EF DJNZ R0,L1
0023 22 RET
END
b)
ADDRESS OPCODES LABELS MNEMONICS OPERANDS
0000 ORG 00H
0000 758920 MOV TMOD,#20H
0003 7455 MOV A,#55H
0005 90FFC0 MOV DPTR, #0FFC0H
0008 1110 LOOP ACALL DELAY
000A F4 CPL A
000B F0 MOVX @DPTR,A
000C F5A0 MOV P2,A
000E 80F8 SJMP LOOP
0010 791C DELAY MOV R1,#1CH
0012 7A20 BACK2 MOV R2,#20H
0014 758D00 BACK1 MOV TH1,#00H
0017 D28E SETB TR1
0019 308FFD HERE JNB TF1,HERE
001C C28F CLR TF1
001E C28E CLR TR1
0020 DAF2 DJNZ R2,BACK1
0022 D9EE DJNZ R1,BACK2
0024 22 RET
END
RESULT: The given Assembly Language Programs are successfully created and verified.
Date: /09/2022
3. PROGRAMS ON COUNTER OPERATION
AIM:
a). Write an Assembly language program in 8051 micro controllers for Counter 0 in Mode 2 to
count the number of pulses and display the count value on port P2 and external memory location
0FFC1H.
b). Write an Assembly language program in 8051 micro controllers for Counter 1 in Mode 2 to count
the number of cycles in square waveform with an frequency of 2KHz and display the count value
on port P2 and external memory location 0FFC1H.
Creating Project:
3. Go to project ->click on new uVision project -> create a new folder saved with experiment
number within the already existed register number folder in D drive mentioned in step 1, ->
enter the project name -> click on save.
4. Select the device for target -> In devices ->Enter P89C51RD2XX in Search toolbar -> click on ok
-> select No for dialog box message “Copy STARTUP.A51 to project folder and add files to
project”.
(or)
Choose NXP -> to select the device P89C51RD2XX -> click on ok -> select No for Copy
STARTUP.A51 to project folder.
CALCULATIONS:
b)
THEORY:
Timers can also be used as counters counting events happening outside the 8051
When it is used as a counter, it is a pulse outside of the 8051 that increments the TH,
TL registers
TMOD and TH, TL registers are the same as for the timer discussed previously
Programming the timer in the last section also applies to programming it as a counter
Except the source of the frequency
The C/T bit in the TMOD registers decides the source of the clock for the timer
When C/T = 1, the timer is used as a counter and gets its pulses from outside the 8051
o The counter counts up as pulses are fed from pins 14 and 15, these pins are
called T0 (timer 0 input) and T1 (timer 1 input)
PROGRAMS:
a)
ADDRE OPCOD LABE MNEMONI OPERNADS
SS ES LS CS
0000 ORG 00H
0000 758906 MOV TMOD,#06H
0003 90FFC1 MOV DPTR,#0FF
C1H
0006 758C00 MOV TH0,#00H
0009 D2B4 SETB P3.4
000B D28C AGAI SETB TR0
N
000D E58A BACK MOV A,TL0
000F F0 MOVX @DPTR,A
0010 F5A0 MOV P2,A
0012 308DF8 JNB TF0,BACK
0015 C28C CLR TR0
0017 C28D CLR TF0
0019 80F0 SJMP AGAIN
END
b)
RESULT: The given Assembly Language Programs are successfully created and verified.