Professional Documents
Culture Documents
ARUNKUMAR
ARUNKUMAR
Laboratory
Record
SEMESTER: 7th
SESSION: 2015-2019
SCHOOL OF ENGINEERING
KOCHI – 682022
EMBEDDED SYSTEMS (EC 15-17L1)
LABORATORY RECORD
DETAILS OF EXPERIMENTS
KEIL
The Keil A51 Assembler is a macro assembler for the 8051 family of microcontrollers. It
supports all 8051 derivatives. It translates symbolic assembly language mnemonics into
1
Arunkumar KR, Reg.no 13160016
relocatable object code where the utmost speed, small code size, and hardware control are
critical. The macro facility speeds development and conserves maintenance time since common
sequences need only be developed once. The A51 assembler supports symbolic access to all
features of the 8051 architecture.
The A51 assembler translates assembler source files into a relocatable object modules. The
DEBUG directive adds full symbolic information to the object module and supports debugging with
the µVision Debugger or an in-circuit emulator. In addition to object files, the A51 assembler
generates list files which may optionally include symbol table and cross reference information.
2
Arunkumar KR, Reg.no 13160016
EXPERIMENT NO: 1
3
Arunkumar KR, Reg.no 13160016
Note:
‘Enter’ key to continue/accept the data for each command
‘ESC’ to exit from any command except execution (Press reset key to exit from
execution)
‘Back Space’ key to decrement address
MENU
On switching the unit after a scrolling display the menu appears as A,B,D,G,M,R,S and T
ASSEMBLER
ENTER START ADDR….
Now the user can enter the starting address from where the assembling is
required Eg.:8000
After entering desired starting address press ‘ENTER’ key on the keyboard. The system
will show a text address screen. Enter a valid assembly instruction in this window. After
entry press ‘ENTER’ again
If a valid assembly code is entered, corresponding code in HEX will be displayed as
8000: 01 80 00
BLOCK COMMAND
F,I,D,M
Select commands from above commands
F : Fill command
I : Insert
D : Delete
M : Move
4
Arunkumar KR, Reg.no 13160016
F : Fill Command
Fill command can be used to fill a specific data in specified locations
FILL DATA
ENTER STARTING ADDRESS:
Then enter the starting address of Fill and press ‘ENTER’. The screen will show:
FILL DATA
ENTER END ADDRESS
Enter end address and hit ENTER key. The screen will show:
DATA:00
Then enter the data to be filled and press ENTER. Data will be filled in specified
locations
I : Insert Command
Insert command helps to reserve some location for inserting bytes. It will move the next
bytes towards down and make free the locations to be inserted. User can insert data in
the locations using Memory edit command after insert command
INSERT
ENTER STARTING ADDRESS:
INSERT
ENTER END ADDRESS:
BYTE COUNT:
Enter Byte count to be inserted. The byte locations will be filled with zero. User can
insert data using memory edit command
5
Arunkumar KR, Reg.no 13160016
D : Delete Command
Delete command helps to delete some location for removing bytes. It will move the
next bytes upward.
DELETE
ENTER STARTING ADDRESS:
DELETE
ENTER END ADDRESS:
BYTE COUNT:
BLOCK MOVE
ENTER STARTING ADDRESS:
BLOCK MOVE
ENTER END ADDRESS:
Enter End address of the data block and press ENTER. The display will show
BLOCK MOVE
DESTINATION ADDRESS:
6
Arunkumar KR, Reg.no 13160016
DISASSEMBLE
ENTER STARTING ADDRESS:
Enter starting address of the code which is to be disassembled. The screen will show
the disassembly code with memory address like
Press ENTER to continue disassembling and ESC for exiting from the menu
MODIFY MEMORY
8000: 00
Enter the new HEX value using 0-9 keys (of the cash register keys only) for number and
A-F keys for data keys. User need to enter only lower digit of the data for one digit
Press ENTER to increment/accept the data and ‘Backspace’ to decrement. User can view
the contents by pressing ‘ENTER’ up memory address. And ‘Backspace’ for down
memory address. Press ‘ESC’ to exit from this mode.
Note: The address to enter the data should be a valid user RAM address
A-00
7
Arunkumar KR, Reg.no 13160016
User can enter to register content by using keyboard. The entry is similar to memory
modify command.
8
Arunkumar KR, Reg.no 13160016
Note: Modifying ‘SP’ will affect the program returns. So one has to be careful while
changing the value of ‘SP’
.
MENU ‘S’ : SINGLE STEP COMMAND
Single step command will help to troubleshoot the program. This can be selected by
pressing ‘S’ key. The system will ask for starting address
SINGLE STEP
STARTING ADDRESS:
BREAK POINT:8000
ACALL 8100
Then select the address for which ‘Break Point’ is to be added. It will automatically
show the previous entered location.
Press ‘ENTER’ key to enable break point and ‘Back Space’ key to disable break point.
Then it will show ‘ENABLED’ or ‘DISABLED’ as selected.
Note: Break Point will come into effect when ‘GO’ command is selected from Main
menu.
If break is encountered in program, it will show ‘Break: 8000’, press ‘ENTER’ to view
the current code of breaking point and press ‘ENTER’ again to continue running the
program
EXECUTE
9
Arunkumar KR, Reg.no 13160016
10
Arunkumar KR, Reg.no 13160016
Now enter the starting address of the program and press ‘ENTER’ again. The display will
show:
EXECUTING….
11
Arunkumar KR, Reg.no 13160016
EXPERIMENT NO: 2
AIM:
Write an assembly language program to add two digits numbers which are stored
in 8100, 8101 and store the result in 8102 and carry in 8103 using 8051 trainer kit.
ALGORITHM:
Step 01: Initially, store the two numbers in locations 8100 and 8101.
Step 02: Load the Data pointer with the address of the first number to be added.
Step 03: Copy the number to accumulator and then to register R0.
Step 04: Increment the data pointer.
Step 05: Copy the next number into the accumulator.
Step 06: Add the number in R0 to the number in accumulator.
Step 07: Increment the data pointer.
Step 08: Store the result in the memory location.
Step 09: Increment the data pointer.
Step 10: Clear the accumulator and copy the carry into the accumulator.
Step 11: Move the carry obtained into the memory location pointed by the data
pointer.
PROGRAM CODE:
12
Arunkumar KR, Reg.no 13160016
OUTPUT:
8100: 10 (Input 1)
8101: 10 (Input 2)
8102: 20 (Sum)
8103: 00 (Carry)
8100: 90 (Input 1)
8101: F0 (Input 2)
8102: 80 (Sum)
8103: 01 (Carry)
RESULT:
The program to add two numbers using trainer kit was successfully executed and
obtained the output.
13
Arunkumar KR, Reg.no 13160016
EXPERIMENT NO: 3
AIM:
Write an assembly language program to subtract two digits numbers which are stored
in 8100, 8101 and store the result in 8102 and borrow in 8103 using 8051 trainer kit.
ALGORITHM:
Step 01: Initially, store the two numbers in locations 8100 and 8101.
Step 02: Load the Data pointer with the address of the first number.
Step 03: Copy the number to accumulator and then to register R0.
Step 04: Increment the data pointer.
Step 05: Copy the next number into the accumulator.
Step 06: Clear the carry bit.
Step 07: Subtract the number in R0 from the number in accumulator.
Step 08: Increment the data pointer.
Step 09: Store the result in the memory location.
Step 10: Increment the data pointer.
Step 11: Clear the accumulator and copy the carry into the accumulator.
Step 12: Move the carry obtained into the memory location pointed by the data
pointer.
PROGRAM CODE:
14
Arunkumar KR, Reg.no 13160016
OUTPUT:
8100: 05 (Input 1)
8101: 03 (Input 2)
8102: FE (Difference)
8103: 01 (Borrow)
8100: E0 (Input 1)
8101: FF (Input 2)
8102: 1F (Difference)
8103: 00 (Borrow)
RESULT:
The program to subtract two numbers using trainer kit was successfully executed
and obtained the output.
15
Arunkumar KR, Reg.no 13160016
EXPERIMENT NO: 4
ALGORITHM:
Step 01: Initially, store the two numbers in locations 8100 and 8101.
Step 02: Load the Data pointer with the address of the first number.
Step 03: Copy the number to accumulator and then to B. Increment the data pointer.
Step 04: Copy the next number into the accumulator.
Step 05: Multiply the numbers in A and B.
Step 06: Increment the data pointer.
Step 07: Store the result in A to the memory location.
Step 08: Increment the data pointer.
Step 09: Copy the content in B to the accumulator.
Step 10: Move it to the memory location pointed by the data pointer.
PROGRAM CODE:
16
Arunkumar KR, Reg.no 13160016
Move Carry To
800B E5,F0 MOV A,B Accumulator
Increment Pointer
800D A3 INC DPTR To Store Carry
OUTPUT:
8100: 05 (Input 1)
8101: 02 (Input 2)
8102: 0A (Product LSB)
8103: 00 (Product MSB)
8100: FF (Input 1)
8101: FF (Input 2)
8102: 01 (Product LSB)
8103: FE (Product MSB)
RESULT:
The program to multiply two numbers using trainer kit was successfully executed and
obtained the output.
17
Arunkumar KR, Reg.no 13160016
EXPERIMENT NO: 5
AIM:
Write an assembly language program to divide two digits numbers which are stored in
8100, 8101 and store the result in 8102 and reminder in 8103 using 8051 trainer kit.
ALGORITHM:
Step 01: Initially, store the two numbers in locations 8100 and 8101.
Step 02: Load the Data pointer with the address of the first number.
Step 03: Copy the number to accumulator and then to B.
Step 04: Increment the data pointer.
Step 05: Copy the next number into the accumulator.
Step 06: Divide the numbers in A and B.
Step 07: Increment the data pointer.
Step 08: Store the result in A to the memory location.
Step 09: Increment the data pointer.
Step 10: Copy the content in B to the accumulator.
Step 11: Move it to the memory location pointed by the data pointer.
PROGRAM CODE:
18
Arunkumar KR, Reg.no 13160016
OUTPUT:
8100: 02 (Divisor)
8101: 06 (Dividend)
8102: 03 (Quotient)
8103: 00 (Remainder)
8100: 06 (Divisor)
8101: 02 (Dividend)
8102: 00 (Quotient)
8103: 02 (Remainder)
RESULT:
The program to divide two numbers using trainer kit was successfully executed
and obtained the output.
19
Arunkumar KR, Reg.no 13160016
Date: 23/07/2018
EXPERIMENT NO: 6
ALGORITHM:
Step 01: Start
Step 02: Initially store the count value at location 8100 and numbers from 8101.
Step 03: Load data pointer with address 8100.
Step 04: Copy the first number to accumulator A and then to register R0.
Step 05: Copy the second number to register B.
Step 06: Clear the accumulator register R1 and carry.
Step 07: Increment data pointer and store data to accumulator.
Step 08: Add the accumulator along with carry and store to R1.
Step 09: Repeat the process from step 6 till the count become zero.
Step 10: Divide the sum with count and store to the next address.
Step 11: End.
PROGRAM CODE:
20
Arunkumar KR, Reg.no 13160016
OUTPUT:
8100: 05 (Count N)
8101: 01 (Num 1)
8102: 02 (Num 2)
8103: 03 (Num 3)
8104: 04 (Num 4)
8105: 05 (Num 5)
8106: 06 (Average)
RESULT:
The program to find average of ‘N’ numbers using 8051 trainer kit was
successfully executed and obtained the output.
21
Arunkumar KR, Reg.no 13160016
Date: 30/07/2018
EXPERIMENT NO: 7
ALGORITHM:
Step 01: Start
Step 02: Initially store two numbers in location 32h and 33h.
Step 03: Move the numbers in accumulator (A) and register (R0).
Step 04: Add the numbers.
Step 05: Store the result which is in accumulator to 34h.
Step 06: Clear the accumulator and add carry to it.
Step 07: Store the carry which is in the accumulator to 35h.
Step 08: End.
PROGRAM CODE:
org 00h
start: mov a,32h ;Store 1st no
mov r0,33h ;Store 2nd no
add a,r0 ;Add
mov 34h,a ;Copy sum at location 34h
mov a,#00h ;Clear accumulator
mov 35h,a ;Add with carry
sjmp start ;Copy carry at location 35h
end
22
Arunkumar KR, Reg.no 13160016
OUTPUT:
d:0x32 = F3 (Num 1)
d:0x33 = F2 (Num 2)
d:0x34 = E5 (Sum)
d:0x35 = 01 (Carry)
RESULT:
The program to find sum of two number using Keil µVision Software is
executed and output was obtained.
23
Arunkumar KR, Reg.no 13160016
Date: 30/07/2018
EXPERIMENT NO: 8
ALGORITHM:
Step 01: Start
Step 02: Initially store the count N in location 32h.
Step 03: Copy data of 32h in register R1.
Step 04: Clear the accumulator.
Step 05: Increment R1.
Step 06: Add the data in accumulator with the data in address of R1.
Step 07: Until the count becomes zero, decrement R0 and jump to ‘step 05’.
Step 08: Store the sum from accumulator to 49h.
Step 09: End.
PROGRAM CODE:
org 00h
start: mov ro,32h ;Store count
mov r1,#32h ;Copt data in register R1
mov a,#00h ;Clear accumulator
label: inc r1 ;Increment count value
add a,@r1 ;Add
djnz r0, label ;Decrement to label if count !=0
mov 49h,a ;Store sum at 49h
end
24
Arunkumar KR, Reg.no 13160016
OUTPUT:
d:0x32 = 05 (Count)
d:0x33 = 01 (Num 1)
d:0x34 = 02 (Num 2)
d:0x35 = 03 (Num 3)
d:0x36 = 04 (Num 4)
d:0x37 = 05 (Num 5)
d:0x49 = 0F (Sum)
RESULT:
The program to ‘N’ number using Keil µVision Software is executed and
output was obtained.
25
Arunkumar KR, Reg.no 13160016
Date: 06/08/2018
EXPERIMENT NO: 9
ALGORITHM:
Step 01: Start
Step 02: Initially store the count N in location 32h.
Step 03: Copy data of 32h in register R1.
Step 04: Clear the accumulator (A).
Step 05: Clear the register R5.
Step 06: Increment R1.
Step 07: For each location in R1 store the data.
Step 08: Add the data with previous number in accumulator.
Step 09: If a carry is generated increment R5.
Step 10: Until the count is zero decrement R0 and jump to ‘Step 06’.
Step 11: Store the sum from the accumulator in 49h.
Step 12: Move the carry generated in R5 to the accumulator.
Step 13: Move the carry from the accumulator to 50h.
Step 14: End.
PROGRAM CODE:
Org 00h
Start: mov r0,32h
mov r1,#32h
mov a,#00h
mov r5,#00h
label: inc r1
add a,@r1
jc label1
26
Arunkumar KR, Reg.no 13160016
jnc label2
label1: inc r5
label2: djnz r0,label
mov 49h,a
mov a,r5
mov 50h,a
sjmp start
OUTPUT:
d:0x32 = 03 (Count)
d:0x33 = FF (Num 1)
d:0x34 = FE (Num 2)
d:0x35 = DA (Num 3)
d:0x49 = D7 (Sum)
d:0x50 = 02 (Carry)
RESULT:
The program to ‘N’ number with carry using Keil µVision Software is executed
and output was obtained.
27
Arunkumar KR, Reg.no 13160016
Date: 06/08/2018
EXPERIMENT NO: 10
ALGORITHM:
Step 01: Start
Step 02: Set P0 & P1 as the input port.
Step 03: Set P2 & P3 as the output port.
Step 04: Move the data from P0 to the accumulator A.
Step 05: Move the data from P1 to the register R0.
Step 06: Add the numbers.
Step 07: Move the sum in the accumulator to Port2.
Step 08: End.
PROGRAM CODE:
org 00h
mov p0,#0FFh ;input port configuration
mov p1,#0FFh ;input port configuration
mov p2,#00h ;output port configuration
mov p3,#00h ;output port configuration
28
Arunkumar KR, Reg.no 13160016
OUTPUT:
PORT P0: P0 0xFF
PINS 0xFF (Input 1)
PORT P1: P1 0xFF
PINS 0xFF (Input 2)
PORT P2: P0 0xFE
PINS 0xFE (Sum)
PORT P3: P0 0x01
PINS 0x01 (Carry)
RESULT:
The program to find sum of two numbers given to ports using Keil µVision
Software is executed and output was obtained.
29
Arunkumar KR, Reg.no 13160016
Date: 03/09/2018
EXPERIMENT NO: 11
FACTORIAL OF A NUMBER
AIM:
Write an assembly language program to find factorial of a number which is
given through ports (using Kiel µVision Software).Observe the output in Proteus
Design Suite Software.
ALGORITHM:
Step 01: Start
Step 02: Set P1 as input port & P3 as the output port.
Step 03: Move the number in R0 register given through Port1.
Step 04: Set the accumulator as 01h.
Step 05: Move the number to register B from R0 register.
Step 06: Multiply ‘A’ and ‘B’.
Step 07: Decrement R0 and until it becomes 0 and jump to ‘Step 06’.
Step 08: Move the factorial of number in A to Port3.
Step 09: End.
PROGRAM CODE:
org 00h
mov p1,#0FFh ;input port configuration
mov p3,#00h ;output port configuration
30
Arunkumar KR, Reg.no 13160016
OUTPUT:
RESULT:
The program to find factorial of a number given to port using Keil µVision
Software is executed and output was verified in Proteus Design Suite.
31
Arunkumar KR, Reg.no 13160016
Date: 06/09/2018
EXPERIMENT NO: 12
SMALLEST OF N-NUMBERS
AIM:
Write an assembly language program to find smallest of N-number (using Kiel
µVision Software) where count is stored at 32h and numbers are stored from location
34h. Store the result at 33h.
ALGORITHM:
Step 01: Start
Step 02: Store count value at location 32h.
Step 03: Store the numbers starting from location 34h and copy it to R1.
Step 04: Copy first number to accumulator.
Step 05: Clear the carry and subtract content of accumulator and R1.
Step 06: Subtract the numbers till count is zero to get smaller numbers.
Step 07: Store result at location 33h.
Step 09: End.
PROGRAM CODE:
org 00h
start: mov r0,32h
dec r0
mov r1,#34h
mov a,34h
label1: clr c
inc r1
mov r5,a
subb a,@r1
jnc label2
jc label3
32
Arunkumar KR, Reg.no 13160016
D:0x32 = 05 (Count)
D:0x34 = 01 (Input 1)
D:0x35 = 02 (Input 2)
D:0x36 = 03 (Input 3)
D:0x37 = 04 (Input 4)
D:0x38 = 05 (Input 5)
D:0x33 = 01 (Result)
RESULT:
The program to find factorial of a smallest of N-number using Keil µVision
Software is executed and output was verified.
33
Arunkumar KR, Reg.no 13160016
Date: 17/09/2018
EXPERIMENT NO: 13
BLINKING OF LED
AIM:
Write an assembly language program to blink a LED with time period 1 sec
(using Kiel µVision Software). Observe the output using Proteus Design Suite
software.
ALGORITHM:
Step 01: Start
Step 02: Configure Port-1 as output port.
Step 03: Set Port-1 as 1 to ON the LED.
Step 04: Call a delay function. Go to step 07.
Step 05: Set Port-1 as 0 to OFF the LED.
Step 06: Repeat step 04. Then go to step 03.
Step 07: Set delay for a 20 times loop. Move 14h to register r4.
Step 08: If the bit TF1 is nor set then repeat this step again.
Step 09: Clear TF1 and TR1.
Step 10: Until R4 is nor zero decrement R4 and jump to step 08.
Step 11: Return to delay function
Step 12: End.
PROGRAM CODE:
org 00h
mov p1,#00h
start: mov p1,#01h
lcall delay
mov p1,#00h
lcall delay
sjmp start
34
Arunkumar KR, Reg.no 13160016
delay:mov r4,#14h
label1:mov tmod,#10h
mov th1,#03ch
mov tl1,#0afh
setb tr1
label2: jnb tf1,label2
clr tf1
clr tr1
djnz r4,label1
ret
OUTPUT:
PORT 1 PORT1
P1: 0x01 → P1: 0x00
(After 500 ms)
PINS: 0x01 PINS: 0x00
35
Arunkumar KR, Reg.no 13160016
RESULT:
The program to blink a LED with time period 1 sec using Keil µVision
Software is executed and output was verified Proteus Design Suite.
36
Arunkumar KR, Reg.no 13160016
Date: 17/09/2018
EXPERIMENT NO: 14
4s 1s 4s 1s 4s 1s 4s 1s
R1 P1.7 0 0 1 1 1 1 1 0
ROAD 1 Y1 P1.6 0 1 0 0 0 0 0 1
G1 P1.5 1 0 0 0 0 0 0 0
R2 P1.4 1 0 0 0 1 1 1 1
ROAD 2 Y2 P1.3 0 1 0 1 0 0 0 0
G2 P1.2 0 0 1 0 0 0 0 0
R3 P1.1 1 1 1 0 0 0 1 1
ROAD 3 Y3 P1.0 0 0 0 1 0 1 0 0
G3 P2.3 0 0 0 0 1 0 0 0
R4 P2.2 1 1 1 1 1 0 0 0
ROAD 4 Y4 P2.1 0 0 0 0 0 1 0 1
G4 P2.0 0 0 0 0 0 0 1 0
P1 32H 4AH 86H 89H 90H 91H 92H 52H
P2 04H 04H 04H 04H 0CH 02H 01H 02H
ALGORITHM:
Step 01: Start
Step 02: Configure P1 and P2 as output port.
Step 03: Store in P1 & P2, 32h and 04h respectively and call delay of 4 seconds.
Step 04: Store in P1 & P2, 04ah and 04h respectively and call delay of 1 seconds.
Step 05: Store in P1 & P2, 86h and 04h respectively and call delay of 4 seconds.
Step 06: Store in P1 & P2, 89h and 04h respectively and call delay of 1seconds.
Step 07: Store in P1 & P2, 90h and 0ch respectively and call delay of 4 seconds.
Step 08: Store in P1 & P2, 91h and 02h respectively and call delay of 1 seconds.
Step 09: Store in P1 & P2, 92h and 01h respectively and call delay of 4seconds.
Step 10: Store in P1 & P2, 52h and 02h respectively and call delay of 1 seconds.
37
Arunkumar KR, Reg.no 13160016
PROGRAM CODE:
org 00h
mov p1,#00h
mov p2,#00h
38
Arunkumar KR, Reg.no 13160016
mov p2,#02h
lcall delay1
sjmp start
delay4:mov r4,#50h
l1: mov tmod,#10h
mov th1,#3ch
mov tl1,#0afh
setb tr1
l2: jnb tf1,l2
clr tf1
clr tr1
djnz r4,l1
ret
delay1:mov r4,#14h
l3: mov tmod,#10h
mov th1,#3ch
mov tl1,#0afh
setb tr1
l4: jnb tf1,l4
clr tf1
clr tr1
djnz r4,l3
ret
OUTPUT:
39
Arunkumar KR, Reg.no 13160016
40
Arunkumar KR, Reg.no 13160016
41
Arunkumar KR, Reg.no 13160016
42
Arunkumar KR, Reg.no 13160016
RESULT:
The program for traffic light control using Keil µVision Software is executed
and output was verified Proteus Design Suite.
43
Arunkumar KR, Reg.no 13160016
Date: 08/10/2018
EXPERIMENT NO: 15
VOWEL DISPLAY
AIM:
Write an assembly language program to display vowels using 7 segment
display (using Kiel µVision Software). Observe the output using Proteus Design Suite
software with 7-Segment display.
ALGORITHM:
Step 01: Start
Step 02: Configure Port-1 as output port.
Step 03: move 300h to data pointer.
Step 04: Set 00h to register R2.
Step 05: Set 05h to register R7.
Step 06: Move R2 to the accumulator
Step 07: Move the data in the look up table pointed by the data pointer in the ath
position.
Step 08: Move the value in accumulator to port1.
Step 09: Increment R2 and call a delay for 1 second.
Step 10: End
PROGRAM CODE:
org 00h
44
Arunkumar KR, Reg.no 13160016
mov p1,#00h
delay:mov r4,#14h
l1: mov tmod,#10h
mov th1,#3ch
mov tl1,#0afh
setb tr1
l2: jnb tf1,l2
clr tf1
clr tr1
djnz r4,l1
ret
org 300h
db 77h,4fh,06h,7eh,3eh
end
OUTPUT:
45
Arunkumar KR, Reg.no 13160016
46
Arunkumar KR, Reg.no 13160016
47
Arunkumar KR, Reg.no 13160016
RESULT:
The program to display vowels using Keil µVision Software is executed and
output was verified Proteus Design Suite.
48
Arunkumar KR, Reg.no 13160016
Date: 08/10/2018
EXPERIMENT NO: 16
00-99 COUNTER
AIM:
Write an assembly language program that counts from 00-99 (using Kiel
µVision Software). Observe the output using Proteus Design Suite software with 7-
Segment display.
ALGORITHM:
Step 01: Start
Step 02: Configure P1 & P2 as output port.
Step 03: Set R4 as 0Ah and set R5 as 00h.
Step 04: Move the data from 300h to the data pointer.
Step 05: Set register R3 as 0Ah.
Step 06: Move the value in register R5 to the accumulator A.
Step 07: Move the data from the code memory a+dptr to the accumulator A.
Step 08: Move the data from accumulator A to port P1.
Step 09: Clear the accumulator.
Step 10: Move the data from the code memory a+dptr to the accumulator A.
Step 11: Move the data from accumulator A to port P2.
Step 12: Increment the data pointer.
49
Arunkumar KR, Reg.no 13160016
PROGRAM CODE:
org 00h
mov p2,#00h
mov p1,#00h
start: mov r4,#0ah
mov r5,#00h
label1:mov dptr,#300h
mov r3,#0ah
mov a,r5
movc a,@a+dptr
mov p1,a
label2:clr a
movc a,@a+dptr
mov p2,a
inc dptr
lcall delay
djnz r3,label2
inc r5
djnz r4,label1
sjmp start
delay:mov r6,#14h
label3: mov tmod,#10h
mov th1,#03ch
mov tl1,#0ach
setb tr1
50
Arunkumar KR, Reg.no 13160016
label4:jnb tf1,label4
clr tf1
clr tr1
djnz r6,label3
ret
org 300h
db 7eh,30h,6dh,79h,33h,5bh,5fh,70h,7fh,7bh
end
OUTPUT:
Port 1 Port 2
7E 7E 00
7E 30 01
↓ ↓
↓ ↓
7E 7B 09
30 7E 10
↓ ↓
↓ ↓
7B 7B 99
7E 7E 00
51
Arunkumar KR, Reg.no 13160016
52
Arunkumar KR, Reg.no 13160016
53
Arunkumar KR, Reg.no 13160016
RESULT:
The program to counts from 00-99 Keil µVision Software is executed and
output was verified Proteus Design Suite.
54
Arunkumar KR, Reg.no 13160016
Date: 22/10/2018
EXPERIMENT NO: 17
ALGORITHM:
Step 01: Start
Step 02: Configure P1 & P2 as output port.
Step 03: To initialize the LCD screen move 38h to the accumulator. Call the command
write function and then call delay function.
Step 04: To make the display on and curser blinking move 0Eh to the accumulator.
Call the command write function and then call elay function.
Step 05: To clear the LCD screen move 01h to the accumulator. Call the command
write function and then call delay function.
Step 06: To shift the cursor to the right of the LCD screen move 06h to the
accumulator. Call the command write function and then call delay function.
Step 07: To shift the cursor at line 1 position 4 move 84h to the accumulator. Call the
command write function and then call delay function.
Step 08: Move ASCII value of first character of name to the accumulator. Call the data
write function and then call delay function.
Step 09: Repeat the Step 08 for displaying next character.
Step 10: End.
PROGRAM CODE:
org 00h
mov p1,#00h
mov p2,#00h
mov a,#38h
acall comwrt
55
Arunkumar KR, Reg.no 13160016
acall delay
mov a,#0eh
acall comwrt
acall delay
mov a,#01h
acall comwrt
acall delay
mov a,#06h
acall comwrt
acall delay
mov a,#80h
acall comwrt
acall delay
56
Arunkumar KR, Reg.no 13160016
mov a,#'M'
acall datwrt
acall delay
mov a,#'A '
acall datwrt
acall delay
mov a,#'R'
acall datwrt
acall delay
mov a,#0c0h
acall comwrt
acall delay
l1: sjmp l1
comwrt:mov p1,a
clr p2.0
clr p2.1
setb p2.2
acall delay
clr p2.2
ret
datwrt: mov p1,a
setb p2.0
clr p2.1
setb p2.2
acall delay
clr p2.2
ret
delay: mov r3,#50h
label2:mov r4,#0ffh
label1:djnz r4,label1
57
Arunkumar KR, Reg.no 13160016
djnz r3,label2
ret
OUTPUT:
RESULT:
The program to display your name in LCD Keil µVision Software is executed
and output was verified Proteus Design Suite.
58
Arunkumar KR, Reg.no 13160016
Date: 22/10/2018
EXPERIMENT NO: 18
STEPPER MOTOR
AIM:
Write an assembly language to rotate stepper motor in clockwise direction
(using Kiel µVision Software). Observe the output using Proteus Design Suite
software.
ALGORITHM:
Step 01: Start
Step 02: Configure P1 as output port.
Step 03: To initialize the value 33h to the accumulator. Call the command “RL” or
rotate left function to rotate to the value to obtain the motion.
Step 04: Call the rotate left function and then call delay function.
Step 05: End.
PROGRAM CODE:
org 00h
mov p1,#0ffh
mov a,#33h
start:
rl a
acall delay
mov p1,a
sjmp start
delay: mov r0,#50h
l2: mov r4,#0ffh
l1:djnz r4,l1
djnz r3,l2
ret
59
Arunkumar KR, Reg.no 13160016
OUTPUT:
RESULT:
The program to rotate stepper motor was done in Keil µVision Software is
executed and output was verified Proteus Design Suite.
60