The Task In this project you will be combining and building on what you have don
ID: 3667593 • Letter: T
Question
The Task In this project you will be combining and building on what you have done in the first 2 projects. You are free to reuse any code that you wrote in the previous 2 projects or the provided Project 2 solution. This program should be a full calculator that uses the UART for both input and output. Calculator Operation You calculator should accept full mathematical expressions with 2 numbers and an operator (e.g. "1+2-" and print the result to the UART using the provided module. It should handle the operators to add (+), subtract and multiply (*), but it does not need to handle division. It should accept multiple expressions and generate the appropriate outputs for each expression without manually resetting the simulation (e.g. the input "5-4-1*2-" should output “1" followed by "2"). UART Module The UART Module is available on Blackboard as an ASM file. You can import it into a PLP project by navigating to "Project", selecting "Import ASM file", and then selecting the UART Module ASM file. File Edit View Project Tools Simulation Help Assemble F2 Unsaved Pro Simulate F3Explanation / Answer
For reference:
putrsxUSART function writes string of characters to UART including NULL character.
WritexUSART function writes 1 byte to the UART.
ReadxUSART function reads 1 byte from UART.
Sharing sample Pseudo code:
BEGIN/NEWLINE
Send carriage return to the USART
Send line feed to the USART
END/NEWLINE
Now Main Program
BEGIN
Configure USART to 9600BAUD
DOFOREVER
Display "Calculator Prog"
Display "Enter First Number"
Read first number
Display "Enter Second Number"
Read second number
Display "Operation"
Read operation
Perform required operation
Convert result into string
Remove the leading spaces from result
Display "Result="
Display result.
ENDDO
END
The program endless loop can be called where you send the text
Then get the first number and send text to USART and put first number in operation op1
Simlarly get the second number and send text to USART and put second number in operation op2
Get Data ready , get the peration
Finally perform the operation, use switch case here for ADD, Subtract and multiply.
Now convert to string and Display the result required.
Uart1_Write_Text(msg2)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.