2.2 Get Familiar with the Assignment Project

Todo: Get familiar with the hands-on project, and verify that the project builds with no errors.
  1. Open the assignment project Assignment1 by following the steps listed below:
    1. Open Microchip Studio.
    2. Select File → Open → Project/Solution...
    3. Navigate to Assignment1 and open Assignment1.atsln.
    Info: The hands-on project will be loaded, and the project content listed in the Solution Explorer panel. If required, open the solution explorer by selecting View → Solution Explorer.
  2. Study the assignment project structure. Open the .c files listed in the Solution Explorer and study the implementation of various functions called from main.c.
    Info: The main.c should appear as shown below:
    #define F_CPU 10000000ul
    
    #include <avr/io.h>
    #include <math.h>
    #include <stdbool.h>
    #include <util/delay.h>
    #include <stdlib.h>
    
    #include "main.h"
    #include "clock_config.h"
    #include "io.h"
    #include "usart.h"
    #include "adc.h"
    #include "data_streamer.h"
    
    int main(void)
    {
    	clock_init();
    	io_init();
    	adc_init();
    	usart0_init();
    	
    	while (1)
    	{
    		
    	}
    }
    Info:
    • clock_init(), clock._config.c: Initializes the CPU clock to 10 MHz in clock_config.c.
    • io_init(), io.c: Configures the directions of IO pins used in the hands-on application:
      • Pin PB2, output, TXD
      • Pin PB7, output, LED
      • Pin PA5, analog input, ADC
    • usart0_init(), usart.c: Initializes the USART:
      • Baud rate: 115200
    • adc_init(), adc.c is empty and will be implemented as a part of this assignment
    Tip: To see how and where functions and definitions are implemented, right-click a function followed by goto implementation.
  3. Build the project by selecting Build → Build Solution or by pressing F7. This will generate the project dependencies list.
    Info: avr/io.h is included at the top of main.c. This header file is common for all AVR® devices, and including this file will ensure that the appropriate device header file is included, based on selected project settings. Open iotn1627.h from Solution Explorer → Dependencies to view the ATtiny1627 device header file. Additional information on coding style and structure is available in the AVR1000 application note at www.microchip.com/wwwappnotes/appnotes.aspx?appnote=en591581.
  4. Make sure the project was successfully built in the previous step.
    Tip: If there were build errors, the error list should appear automatically, but it can also be opened manually by selecting View → Error List from the top menu bar.
Result: The project is initialized and ready for development.