Lab 1 AS Review. Arithmetic and Logic Program Debugging
Lab 1 AS Review. Arithmetic and Logic Program Debugging
We`ll use: the AVR Assembler, Microchip Studio IDE and STK500/600 - evolution board.
The second one is free available by link:
https://www.microchip.com/content/dam/mchp/documents/parked-documents/as-
installer-7.0.2542-web.exe
2
First Project Creating
4
First Project Creating
5
First Project Creating
5. Choose
Evolution board
6
First Project Creating
6. Choose a
target which will
run IDE
Select Simulator
8
First Project Creating
7. Select debugger/programmer
9
First Project Creating
10
Debugging a project
1. Breakpoints
To make a breakpoint put your
mouse on a grey stripe and
click on it.
11
Debugging a project
2. Manual debugging.
Use the Debug menu
By pressing the
hotkeys, you can
manually control the
debugging of the
project.
For example:
Continue to pressing
F10 if you`d like to
follow step by step
12
Example 1 numeric systems
15
Example 4. the couple of life hack
// What is the 3-th bit of r22
// 1 or 0?
// if it`s one then r25=255
// else r25=0
Find the function F(r28) of the numbers A(r31), B(r30), C(r29). If F is greater than the number
D(r27), then I(r26)=9, if less then 12. Multiply the numbers E(r25) by I. And in the received
result bits under the G number, if the bit is 1, then write all ones in the resulting register (r20),
and if the bit is 0, then all zeros.
An example:
Function: F=A-B+3*C,
Where A=160, B=55, C=2, D=110, E=2, G=5.
When F=160-55+3*2=111
Compare the resulting number with the number D=110. It is more, therefore I = 9. We carry
out multiplication 2*9=18. The number 18 in the binary system will be 00010010. Bit with the
number G=5 is equal to 1 - 00010010. The resultant r20 register write all ones.
17
Lab 1. The forms
Forms Function (F) A B C D E G
1 A+3*B-C 12 32 53 120 2 0
2 2*A+B+C 4 150 9 76 3 1
3 A+3*B+C 45 14 34 244 4 2
4 A-2*B+C 232 68 10 65 2 3
5 (A+B)-C 105 29 74 101 3 4
6 2*(A-B)+C 68 43 129 149 4 5
7 A+(B-2*C) 22 142 62 48 2 6
8 A-(B+C) 178 13 102 50 3 7
9 A-B-2*C 164 54 20 71 4 0
10 (A-B)+3*C 35 10 5 15 2 1
11 3*A+B-C 5 100 53 78 3 2
12 A+3*B-C 50 15 7 64 4 3
13 2*(A-B)+C 158 126 147 232 2 4
14 A+2*(B+C) 67 42 3 81 3 5
15 A-B+3*C 241 179 7 115 4 6
18
Useful links and reading
1. Microchip Studio IDE page free download:
https://www.microchip.com/content/dam/mchp/documents/parked-
documents/as-installer-7.0.2542-web.exe
2. Getting started with Microchip Studio. Video tutorials ep.1-6
https://www.youtube.com/watch?v=9W7tPUkaUZ0&list=PL9B4edd-
p2ajRbjkjMuTt8lz_VeE8IKva
3. Atmel assembler instructions free download
http://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-
instruction-set-manual.pdf
4. Atmel assembler for beginners Beginners Introduction to the Assembly
Language of ATMEL-AVR-Microcontrollers by Gerhard Schmidt http://www.avr-
asm-tutorial.net April 2020.
19