You are on page 1of 4

Embedded Systems Lab

Expt. No: 17 Date: 2-8-11

TRANSPOSE OF A MATRIX

AIM:
To find the transpose of a matrix using 8051 microcontroller.

TOOLS REQUIRED:
Vision from Keil for an 8051 microcontroller family.

PROCEDURE:
1.Create a project in Vision. 2.Set the device to AT89C51. 3.The source code is written in the text window and is saved as .asm file. 4.Add the source file into the Source Group. 5.Build target. 6.Start the debug session. 7.Enter the data values in the source address through memory window 8.Run the program. 9.Observe the result in the memory window.

Department Of ECE SNGCE

Embedded Systems Lab

ALGORITHM:
Start

Load: Source Location Destination Location Number of rows (R) Number of columns (C)

Reload: Total number of rows Matrix Start Address

Initialize: Column Count = Total number of columns

Decrement Column Count

NO

Column Count = 0 ? YES Stop

Transposed columns = Total columns Column Count

Row Start Address = Matrix Start Address + Transposed Columns

Element Address = Row Start Address

Store Next Element at destination Element Address = Row Start Address + Total Columns

Increment Destination Addr Decrement Row Count

Row Count = 0?

NO

Department Of ECE SNGCE YES

Embedded Systems Lab

PROGRAM:
ORG 0000H MOV R0,#50H MOV R1, #70H MOV R3, #3H MOV R4, #04H LOOP: MOV R6,#4H MOV A,@R0 MOV @R1, A LOOP1: INC R0 DJNZ R6, LOOP1 INC R1 DJNZ R3, LOOP MOV R3, #3H MOV A, R0 CLR C SUBB A, #4H CLR C SUBB A, #07H MOV R0, A DJNZ R4, LOOP HERE: SJMP HERE END Department Of ECE SNGCE 3

Embedded Systems Lab

RESULT WINDOW:
Input Window:

Output Window:

RESULT:
An assembly program for finding the transpose of a matrix has been written, executed and the output has been verified.

Department Of ECE SNGCE

You might also like