DOC

Microprocessor lab 3 prelab

By Craig Kelly,2014-02-25 00:51
6 views 0
Microprocessor lab 3 prelabMicr

    Hui Zhang

    Lab3

    9-11-12

    SECTION: 1539

    LAB3 Pre-laboratory Report

    Section 1:

    1.1 Program Description

    Part2: Write an Assembly code program that find the maximum score and minimum

    score from a list of test scores using two for-loops. Part3: Set up an 8 bit LED display on the F28335 board, which allows us to see the

    program is doing through the LED lights. It is for debugging purpose.

    Part4: Add a 4 bit DIP switch onto the F28335 board. This allows us to input

    information during program execution.

    1.2 Flowchart

    Start

    score_vector_lencounter =

    AL = 0InputMin = score(i)

    counter - -

    counter = score_vector_len

    AL = 0

    max = score(i)AL = score(i++)counter - -AL = AL min

    AL = score(i++)

    AL = AL maxN flag = 0?

    YESNO

    NO

    N flag =1?YESAL = score(i+1)NOMin = AL

    NO

    Counter - -YESAL = score(i+1)

    Max = AL

    Counter = 0?Counter - -

    YESCounter = 0?

    END

    Hui Zhang

    Lab3

    9-11-12

    SECTION: 1539

    1.3 Schematic

1.4 Problems Encountered

    While writing the assembly code, I had a problem where I tried to copy the score_vector_len to the counter. Apparently, it doesn’t work if I simply write MOV *AR3, *AR2 (where AR3 = score_vector_len and AR2 = counter). I couldn’t compile

    it with that line of code. Instead, I had to move the score_vector_len to accumulator, and then copy the value in accumulator to the destination AR2, which is counter.

    Also, I had a lot of problems with writing the test program for LED and switch. The email from EEL4744 group helped me solve this problem.

    1.5 Future Work/Applications

    To go future after finding the minimum and maximum, we can look into finding outliers from a list of grades or even create a list of ranked score.

    Hui Zhang

    Lab3

    9-11-12

    SECTION: 1539

1.6 Program Code

    2 ; Lab3: Assembly programming & Elementary Wiring

    3 ; Hui Zhang

    4 .global _c_int00

    5 ;------------------------------------------------------------------- 6 ;constants

    7 ;------------------------------------------------------------------- 8 score_addr .set 0xA002 ;set starting address for the

    score vectors in memory

    9 score_vector_len .set 0xA001 ;address of the vector_length 10 data_sect .set 0xa000 ;constant that is actually the starting

    addr of .data section

    11 bss_sect .set 0xb000 ;constant that is actually the starting

    addr of .bss section

    12 ;------------------------------------------------------------------- 13

    14 ;******** DATA ALLOCATION SECTION - Variables/Data ************** 15 .data ;data section starts at 0xA000 16

    17 counter .word 0h ; empty it first

    18 vector_length .word 5

    19

    20

    21 scores .word 33 ; 0-100, create the scores 22 .word 50

    23 .word 65

    24 .word 8

    25 .word 20

    26

    27 .bss max_addr, 1

    28 .bss min_addr, 1

    29 .global

     score_addr,score_vector_len,counter,vector_length,num4,counter,scores,ma

    x_addr,min_addr

    30 .text

    31 _c_int00: ;PROGRAM STARTS HERE 32

    33 MOV AR0, #score_addr

    34 MOV AR1, #max_addr

    35 MOV AR2, #score_vector_len 36 MOV AR3, #counter

    37 MOV AL, *AR2

    38 MOV *AR3, AL

    39 DEC *AR3

    40 MOV AL, #0

41 MOV AL, *AR0

    42 MOV *AR1, AL

43 LOOP1 INC AR0

    Hui Zhang

    Lab3

    9-11-12

    SECTION: 1539

    44 MOV AL, *AR0

    45 SUB AL, *AR1

    46 B YES1, LT

    47 MOV AL, *AR0

    48 MOV *AR1, AL

    49 YES1 DEC *AR3 ;decrement counter 50 B LOOP1, NEQ

    51 NOP

    52 NOP

    53

    54 ;find min_score 55 MOV AR0, #score_addr

    56 MOV AR1, #min_addr

    57 MOV AR2, #score_vector_len 58 MOV AR3, #counter

    59 MOV AL, *AR2

    60 MOV *AR3, AL ;put the length to counter 61 DEC *AR3

    62 MOV AL, #0 ;empty the AL 63

    64 MOV AL, *AR0

    65 MOV *AR1, AL

66 LOOP2 INC AR0

    67 MOV AL, *AR0

    68 SUB AL, *AR1

    69 B YES2, GEQ

    70 MOV AL, *AR0

    71 MOV *AR1, AL

    72 YES2 DEC *AR3 ;decrement counter 73 B LOOP2, NEQ

    74 NOP

    75 NOP

Report this document

For any questions or suggestions please email
cust-service@docsford.com