Secure Computation Laboratory

Charles H. Knapp Associate Professor Marten van Dijk


ECE3411: Microprocessor Applications Laboratory (Fall 2016)

Instructor: Marten van Dijk TA: Chenglu Jin

The previous offering in Fall 2015 can be found here: (ECE3411 Fall 2015)

Course Introduction

The basis of sophisticated designs of modern digital systems that appear in products such as automobiles, appliances and industrial tools is the Micro Controller Unit (MCU); a microcomputer optimized for single-chip system design for controlling peripheral devices geared to real-time applications. We will use the Atmega328P microcontroller (from the Atmel MEGA series RISC microcontrollers) in a series of labs to design microcontroller based systems. In particular, we will explain how to read and use the Atmega328P datasheet and how to write self-explanatory C code for interfacing with the MCU and controlling peripheral devices. This includes initializing register values, writing Interrupt Service Routines (ISRs), constructing underlying Finite State Machines (FSMs), and using a task based programming approach based on hardware timers.

Throughout the course students will learn the basics of C (without advanced data structures that involve pointers) and learn how to use C to program a Micro Controller Unit (MCU). This class aims to educate engineering students with little coding background. I.e., as a prerequisite students are expected to have some experience with basic structures such as loops, if-else statements, arrays, etc. (e.g., as used in MATLAB).

This class offers an intermediary course which allows students to prepare themselves for MCU courses which expect students to have real experience with C, e.g., Bruce Land’s course at Cornell. Our goal is to use the new ECE 3431 class as a prerequisite to a to-be-developed advanced MCU applications lab where we will teach the topics including real time OS, networking protocols such as CAN bus and ZigBee, OLED displays, motor control applications and much more.

Textbook: Elliot Williams, Make: AVR Programming, 2014.

Accessing Instructor's Material

The links below provide the student view of all the taught material. If you are a colleague faculty member, you can email at in order to get access to all the pptx, latex, and C source files together with all the solutions (which are omitted from the student view).
However, there is one catch: you need to acknowledge this course by adding (where appropriate) the following footnote to your slide decks:

Moreover, you need to suggest how the course can be improved and share with us the new quiz/final questions or lab problems as developed by you.

Student's Material

The links below provide all the lecture notes, labs and the class/lab quizzes. If you are a student following these lectures and want to get the solutions of the labs/quizzes, you can email at to first show what code/solution you have attempted by yourself, and then get the complete solutions.

Preliminary Resources

Before coming to the first lecture/lab:

  • Place the order of your MCU kit and other components mentioned in the Online Ordering List.
  • Make sure to have set up Eclipse/GCC & Atmel Studio; see Tools Setup which explains how to do this for your laptop, you do not have time for installing software during lab!
  • Sign up for Piazza.

Week Date Lecture Lab Textbook Reading Assignment
1 29 Aug Lec1a: Course Outline + Introduction to C-Programming Lab1a: Examples basic C-Programming
31 Aug Lec1b: Microcontroller introduction + General Purpose Digital Output (GPDO) Lab1b: Examples basic C-Programming Continued Ch1.
Ch2. till page 21
Ch2. 3
Ch2. 4
2 5 Sep Labor Day – no classes Labor Day – no classes
7 Sep QUIZ 1: C-Programming (Sample Quiz) TEST 1: Basic C-Programming using Eclipse (Sample Lab Test)

Your Fail/Pass the first QUIZ and TEST is a good indicator for being able to successfully complete this course!

  • Courses dropped after Monday September 12th will have a “W” for withdrawal recorded on the academic record.

From now on:

  • You will need to submit a lab report (not handwritten) each week Monday summarizing the preceding week's lab solutions (see syllabus)
  • Each lecture will start with a 5 minute short quiz/question about the reading assignment, posted lecture notes for that lecture, and previous lab.
  • During each lab we will step-wise present (and post at Piazza) solution slides in order to keep the whole class in sync: you will have time to first code up your own answers.
  • Highly Recommended: Write and maintain easy to understand template solutions yourself: This allows you to pick and choose code segments during lab tests.
  • Notice: The sample quizes and sample lab tests provided may not have 100 points.

Week Date Lecture Lab Textbook Reading Assignment
3 12 Sep Sample Class Question
Lec2a: Universal Asynchronous Receiver & Transmitter (UART))
Lab2a: AVR Board Setup (soldering) + LEDs (GPDO) Ch. 5 till page 97
14 Sep Sample Class Question
Lec2b: General Purpose Digital Input (GPDI) + LCD Display
Lab2b: UART (recognizing strings)
Related Files: uart.h, uart.c
Ch. 6
4 19 Sep Sample Class Question
Lec2c: Interrupt Service Routine (ISR)
Lab2c: LCD + General Purpose Digital Input (GPDI)
Related Files: lcd_lib.h, lcd_lib.c
21 Sep QUIZ 2: GPDO, GPDI, LEDs, UART, LCD (Sample Quiz) TEST 2: GPDO, GPDI, LEDs, UART (no LCD) (Sample Lab Test)

Week Date Lecture Lab Textbook Reading Assignment
5 26 Sep Sample Class Question
Lec3a: ISRs + Timer 0 + Task based programming
Lab3a: Non-blocking UART + debounced switches (uses ISR) Ch. 9
28 Sep Sample Class Question
Lec3b: Timers 0, 1, and 2
Lab3b: Non-blocking LCD
6 3 Oct Sample Class Question
Lec3c: External Interrupt + Pin Interrupt
Lab3c: Non-blocking LCD continued Ch. 8
5 Oct Quiz 3: Main focus: ISRs, Timers, nonblocking UART and LCD, External and Pin Interrupts (Sample Quiz) Lab Test 3: Main focus: ISRs, Timers, nonblocking UART and LCD, External and Pin Interrupts (Sample Lab Test)

Week Date Lecture Lab Textbook Reading Assignment
7 10 Oct Sample Class Question
Lec4a: External Interrupt + Task based programming
Lab4a: Human reaction time + Capture Interrupt Timer 1
12 Oct Lec4b: Review Session Lab4b: Stopwatch
8 17 Oct Sample Class Question
Lec4c: Pulse Width Modulation (PWM)
Lab4c: Stopwatch continued Ch. 10
19 Oct Quiz 4: Main focus: Pin Change Interrupt, External Interrupt, PWM, Timers (Sample Quiz) Lab Test 4: Main focus: Pin Change Interrupt, External Interrupt, Timers (Sample Lab Test)

We will provide a prediction of your final score based on the average of your last three quiz/lab test scores.

  • Monday October 31st is the last day to drop the course.

From now on:

  • We will not present any solution slides during lab: You will work on your own solutions during lab time and you can ask the instructor(s) questions and ask for explanations where needed.
  • From Lab6b onwards you are required to be even more independent: We will not lecture the new concepts, you will study the concepts with minimal guidance from the lab problem slides and you will extract information from the datasheet on your own.

Week Date Lecture Lab Textbook Reading Assignment
9 24 Oct Sample Class Question
Lec5a: Analog-to-Digital Conversion (ADC)
Lab5a: PWM Ch. 7
26 Oct Sample Class Question
Lec5b: Analog-to-Digital Conversion (ADC)
Lab5b: ADC Ch. 12
10 31 Oct Sample Class Question
Lec5c: EEPROM + Watchdog Timer
Lab5c: Debugging using Atmel Studio
Related Files:
Ch. 18: p. 387-396
Ch. 19
Ch. 20
2 Nov Quiz 5: Main focus: PWM, ADC, EEPROM, Watchdog, Debugging (Sample Quiz) Lab Test 5: Main focus: PWM, ADC (Sample Lab Test)

Week Date Lecture Lab Textbook Reading Assignment
11 7 Nov Sample Class Question
Lec6a: Task based programming revisited + Real Time Operating System (RTOS) global understanding
Lab6a: EEPROM + Watchdog + Assembly
9 Nov Sample Class Question
Lec6b: RTOS continued + SPI
Lab6b: SPI
Ch. 16
12 14 Nov Sample Class Question
Lec6c: I2C + RedBot (PID control) + Servo Control
Lab6c: SPI + DAC Ch. 11
Ch. 15
Ch. 17
16 Nov Quiz 6: Part of the quiz will be about RTOS (Sample Quiz) Lab Test 6: Part of the lab test is about SPI (Sample Lab Test)

Week Date Lecture Lab Textbook Reading Assignment
21 Nov Thanksgiving Recess – no classes Thanksgiving Recess – no classes
23 Nov Thanksgiving Recess – no classes Thanksgiving Recess – no classes
13 28 Nov Sample Class Question
Lec7a: Advanced Topics
Lab7a: I2C + RedBot
30 Nov Lec7b: Review Session Lab7b: RedBot Ch. 17
14 5 Dec Quiz 7: Main focus: SPI, I2C, DAC, Advanced Topics(Sample Quiz) Lab Test 7: Main focus: I2C/SPI, DAC(Sample Lab Test)

Week Date Lecture Lab Textbook Reading Assignment
7 Dec Advertisement Advanced MCU Application Lab; Q&A RedBot Demo
15 12-16 Dec Finals Week - No Final Finals Week - No Final

Disclaimer: The course schedule is subject to change.