In this assignment, you will be writing an assembly program that uses the USART to receive characters from your PC (via the RealTerm application) and, as each incoming character is received, immediately transmit that same character back to the PC, where it will be re-displayed within the RealTerm application.
You may use the USARTDemo program code as a reference for a program (in Lab5.asm) that contains only a "main" body of code which does the following, as illustrated by the flowchart:
Within your Lab5.asm file, you must .INCLUDE a file named rs232_dd.asm, which you must write. This file will contain a number of subroutines as illustrated by the following UML class diagram:
The subroutines in this file are to be written according to the following "interface" specifications:
This subroutine initializes the USART, enabling it to both transmit and receive, with the configuration specified by the values of the registers indicated in the table below.
Baud Rate (R25) |
The baud rate that is to be used. The baud rate values specified via R25 are as follows: R25=0
-> 2400 baud, |
Frame Length (R23) |
The number of bits within the data frame, specified via R23 as follows: R23=0 -> 5 bits |
Parity (R21) |
The parity setting specified via R21 as follows: R21=0 indicates no
parity. |
This subroutine transmits a single byte. The byte that is to be sent is passed in as a parameter specified via R25.
This subroutine receives a single byte. This call is blocking; that is, it waits in a loop until a byte is received.
These last two subroutines will not be implemented fully in this lab assignment. For now, just make each one return immediately.
EVERY subroutine must have the following format:
;****************************************************************************************************************
;subroutine sub1
; This subroutine <explanation follows>.
; Describe the arguments passed to the subroutine via registers.
; Describe the return value returned by the subroutine via a register
sub1:
<register save to stack>
<code>
<register restore from stack>
ret
;***************************************************************************************************************
Note that you do not have to use the "delay.asm" subroutine supplied with the example code. It is there to help you understand how subroutines can be constructed to accept arguments and pass return values via registers.
You must demonstrate your working program on your board before the submission date.
For your submission, you need only supply your working, fully commented Lab5.asm and rs232_dd.asm files.
Upload your submission through
Blackboard (assignment "Lab 5").
Be sure to keep copies of all your files, in case something gets lost.
Your lab grade will be determined by the following factors:
Program - comments and formatting are important aspects of assembly language programming! And it has to work correctly.
Timeliness of submission as stated in the course policies.