Part 1: Getting familiar with Atmel/Microchip Studio
Write your answers for each question below (specify the line numbers of each question) in the following answer part.
- Make sure that Atmel/Microchip Studio is installed on your computer.
- Start the “Atmel/Microchip Studio” program on your PC.
- Initiate a new project from File -> New -> Project, choose “Assembler” from “Installed”, browse your Lab0 drive location in “Location” at the bottom, and edit the name as “lab0-lastname”.
- Choose “ATmega32” as the device in the next window.
- Copy the content of the below “lab0.asm” and paste it to your new “main.asm” window in Atmel Studio.
- Open the “Project” tab and choose “lab0-lastname Properties”. In the “Tool” tab, choose “Simulator” in the “Selected debugger/programmer” menu. Close the properties tab.
- Assemble (Build -> Build Solution)
- In the "Debug" tab, press the “Start Debugging and Break (Alt + F5)” and start pressing the F10 button to see the steps of the simulation. What do you observe? What is happening in the loop? Write down your observations in the answer part.
- Keep trying the "Run to Cursor" and "Reset" controls under the "Debug" tab. Write down your observations in the answer part.
- While debugging the code, observe register R16 in the "Processor Status" window, which should be on the right or can be accessed with the "Processor Status" icon on the menu above. What is happening to R16? Write down your observations in the answer part.
- There is a "Cycle Counter" field in the "Processor Status" window. Observe its characteristics as you run the code step-by-step in Debug mode, and write down your observations in the answer section.
- On the menu above find "Registers", "Memory", and "I/O" icons, and observe what they display. Write down your observations in the answer part.
- Show and demo your environment to the instructor/TA.
- Part 1 is all done. Thanks.
;*************************************************************************************;* ;* File Name : "lab0.asm";* Title : ELEC/COMP 317 first program;* Date : Februrary 19, 2021;* Version : 1.0;* Target MCU : ATmega32;*;* DESCRIPTION;*;* A simple program that turns off LEDs on the EasyAVR Development Kit;* when the corresponding button is pressed.;*
;*************************************************************************************rjmp RESET ; Set up the reset vector.
; Other vector setup really should go here...
RESET:
ldi R16, $FF ; All ones makesout DDRB, R16 ; port B all outputsldi R16, $00 ; All zeros makesout DDRD, R16 ; port D an input
LOOP:in R16, PIND ; Read buttons from port Dcom R16 ; 1`s complementout PORTB, R16 ; Output value of buttons to port Brjmp loop ; Forever