Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Thank you for your help Pseudo-code is a programming-like language that assists in program design, but is simpler or not as well defined as a

Thank you for your help image text in transcribed
image text in transcribed
Pseudo-code is a programming-like language that assists in program design, but is simpler or not as well defined as a programming language. Pseudo-code will be used throughout CSC 230 and will appear similar to statements in the C, Python or Java programming languages. It will be used to both define algorithms and serve as documentation throughout assembly language code. Consider the following pseudo-code 'program': numberl = 103; number2 - 41; number3 - 15; diff = numberl; diff -= number2; diff -= number3; result = diff; Essentially, this program' calculates the difference of 3 constant values, numberl - number 2 - number 3, stores the result in memory location called result. In Assignment 2 Part 1, this pseudo-code will be: Translated into AVR assembly language, Tested on the AVR studio simulator First, recall that the AVR microcontroller uses the Harvard architecture: Code Segment AVR Microcontroller Data Segment The program that will be run by the microcontroller must be uploaded into the code segment, which is a flash memory, then the program is run by the microcontroller that can use the data segment, which is a static random access memory (SRAM), to store both temporary values and result. Observe that the code segment can be initialized, as it is when we upload the program, but the data segment cannot. Thus, we must store the initial (hard coded) values used by the program in the code segment, along with the program. After each line use an AVR load instruction, where one operand is a register and the other uses immediate addressing, to create these instructions in assembly language. Build and simulate program execution, checking for correctness. Build and (if no errors) simulate the run (or debug) of the program. Create a comment for the diff = numberl; instruction, then code it in assembly language. Create a comment for each of the lines that calculate the difference and code in assembly language (using the SUB instruction), where both operands are registers. Build and (if no errors) simulate the run (or debug) of the program. (Set up the SRAM:) Create a memory location for the result, which we will assume to be 1 byte long, in the Data Segment by typing result .db 1 on the very last line, immediately following the .dseg and .org 0x200 assembler directives. Observe that the SRAM memory address (in hexadecimal) Ox200 has been named result and 1 byte has been set aside for it. Build and (if no errors) simulate the run (or debug) of the program. Observe the SRAM at location Ox200 in the simulator. (Back to the code segment:) Create a comment for the result = difference; instruction. Use the store instruction with direct addressing to specify the location of result. Build and (if no errors) simulate the run (or debug) of the program. Observe the SRAM at location Ox200 in the simulator. Adjust the top of code comments to appropriately describe the program. Pseudo-code is a programming-like language that assists in program design, but is simpler or not as well defined as a programming language. Pseudo-code will be used throughout CSC 230 and will appear similar to statements in the C, Python or Java programming languages. It will be used to both define algorithms and serve as documentation throughout assembly language code. Consider the following pseudo-code 'program': numberl = 103; number2 - 41; number3 - 15; diff = numberl; diff -= number2; diff -= number3; result = diff; Essentially, this program' calculates the difference of 3 constant values, numberl - number 2 - number 3, stores the result in memory location called result. In Assignment 2 Part 1, this pseudo-code will be: Translated into AVR assembly language, Tested on the AVR studio simulator First, recall that the AVR microcontroller uses the Harvard architecture: Code Segment AVR Microcontroller Data Segment The program that will be run by the microcontroller must be uploaded into the code segment, which is a flash memory, then the program is run by the microcontroller that can use the data segment, which is a static random access memory (SRAM), to store both temporary values and result. Observe that the code segment can be initialized, as it is when we upload the program, but the data segment cannot. Thus, we must store the initial (hard coded) values used by the program in the code segment, along with the program. After each line use an AVR load instruction, where one operand is a register and the other uses immediate addressing, to create these instructions in assembly language. Build and simulate program execution, checking for correctness. Build and (if no errors) simulate the run (or debug) of the program. Create a comment for the diff = numberl; instruction, then code it in assembly language. Create a comment for each of the lines that calculate the difference and code in assembly language (using the SUB instruction), where both operands are registers. Build and (if no errors) simulate the run (or debug) of the program. (Set up the SRAM:) Create a memory location for the result, which we will assume to be 1 byte long, in the Data Segment by typing result .db 1 on the very last line, immediately following the .dseg and .org 0x200 assembler directives. Observe that the SRAM memory address (in hexadecimal) Ox200 has been named result and 1 byte has been set aside for it. Build and (if no errors) simulate the run (or debug) of the program. Observe the SRAM at location Ox200 in the simulator. (Back to the code segment:) Create a comment for the result = difference; instruction. Use the store instruction with direct addressing to specify the location of result. Build and (if no errors) simulate the run (or debug) of the program. Observe the SRAM at location Ox200 in the simulator. Adjust the top of code comments to appropriately describe the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago