Question: The second part of the laboratory task ( Section 3 c ) requires you to add the values extracted from the table together using 8

The second part of the laboratory task (Section 3c) requires you to add the values extracted
from the table together using 8-bit arithmetic. If we assume a student number digit of 1, then
the algorithm becomes:
The first part of the algorithm requires you to multiply the value of k by 2. Whilst the AVR
does have a multiply Assembler instruction (MUL) what other operation can be performed to
multiply an 8-bit unsigned integer by two?
The next part of the algorithm then requires the two values extracted from the lookup table
keyTable to be added together. Reviewing the values of keyTable shows that keyTable[2]
=0x98(152 decimal) and keyTable[5]=0x09(9 decimal). Adding these two hexadecimal
digits together results in 0xA1(161 decimal) being assigned to keySum. Note that in
Assembler / C, array (table) indices start at 0.
For an 8-bit computation, the maximum result that can be stored is 0xFF (255). Beyond that,
we require the use of a carry-bit. Based on the Assembler instructions, for a 16-bit
computation (Section 3g) you will need to use an Add instruction, followed by an Add with
Carry.
As you develop your solution it is high recommended to write small pieces of test code that
assist in understanding how the instructions operate. Assembler can become complicated
quickly if you try to do everything at once. Remember that you can comment out sections of
code using a semicolon ;.
3) Another important component of the l

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!