TECH 4234
Microprocessor Interface Technology
Fall 2018

Instructor Info

Daniel Kohn
Email: dekohn@memphis.edu
Office ET218
Phone: 678-4515
Office Hours

Course Info

Course Policies
GradeWatch Access

Assignment Submission

Submit Assignments

Required Text

The AVR Microcontroller and Embedded Systems Using Assembly and C: Using Arduino Uno and Atmel Studio by Sarmad Naimi and Muhammad Ali Mazidi 2nd Ed

Author's Website http://nicerland.com/
Note: the link for the ppt's for chapter 7 on the website is incorrect. Use this link.

Required Software

Atmel Studio 7
Arduino IDE (for avrdude utility)

Course Outline:

DateTopicReadingHandoutsAssignments
Aug 28Welcome

Course Policies
  Lab #0 - Install Atmel Studio 7 using link above (using web installer).

Next add "Terminal for Atmel Studio" by going Help | Atmel Gallery | Extensions | Terminal for Atmel Studio. You will have to close and reopen Atmel Studio and then it will apear in the VIEW menu.

Next we will set up Atmel Studio to send code to arduino boards using avrdude (see below for strings).

Next we will start a project, copy the blink code from here into the project, modify the code (to blink the LED on the arduino), compile it and send it to the arduino board to verify it works.
Aug 30Intro to Atmel328P Class Notes 
Sep 4General Purpose IOChp 4
Chp 7
PPT
Lab #1
Sep 6GPIO (Cont)  In Class Assignment #1 - Write a program that will use PORTD as an input port and display the port value to the terminal (in Hex). Add statements to the program to MASK PORTD Pin 4 so that it prints "Depressed" when ONLY THAT BUTTON is pressed.
Sep 11Analog to Digital (ADC)Chp 13Setup printf for Floating Point valuesLab #2 - due via electronic submission at start of lab next week (including demo).
Sep 13InterruptsChp 10.3 In Class Assignment #2 - write a program that will interrupt when a switch goes from a low to a high and toggle an LED when it occures.
Sep 18Interrupts (cont)  Lab #3 - due in one week (electronic submission and hand written work).
Sep 20Finish Lab #3   
Sep 25No Class or Lab (Instructor Out)   
Sep 27Commenting Code


Timers
Creating and Debugging Programs
NASA C Style Guide

Chp 9
  
Oct 2Timers (cont)Chp 15 Lab #4 - Read a light to frequency sensor and display timer tics and frequency to terminal. Due by end of lab. (Don't forget to comment!)
Oct 4Work on Lab #5  Lab #5

Excel for Notes vs Freq
Oct 9Work on Lab #5   
Oct 11No Class - Instructor out of town (Work on Lab)   
Oct 16No Class - Fall break   
Oct 18Work on Lab #5   
Oct 23Work and complete Lab #5   
Oct 25I2CChp 18Intro 
Oct 30LCD (Lab #6)  Lab #6 - due Nov ??.

Note: DO NOT start project with I2C selected....manually set up I2C using sample code as instructed in handout.

LCD Data Sheet
RGB Backlight
Chp 18 code (select 18_3.c from pulldown)
Nov 1Finish Lab #6   
Nov 6I2C Read  Lab #7 - display the output from a ADXL345 accelerometer to the terminal.
Nov 8Finish Lab #7   
Nov 13SPIChp 17 In Class Assignment #3 - Use sample programs 17_3.C and 17_4.C to communicate between two arduino boards.

Lab #8 - Repeat Lab #7 using SPI instead of I2C.
Nov 15Continue working on Lab #8 Sample SPI code 
Nov 20Work on Lab #8 on your own   
Nov 22Thanksgiving Break   
Nov 27Final Project  Lab #9 (Final Project) - Using the robot bases in ET 227 modified for Arduino (see pic) and using the onboard H-Bridge and your assigned sensor (see below) write the program that will have the robot go forward until it encounters an object within 2 ft. If within that range, generate a random number and turn left 30 deg or right 45 deg based on the random number, then continue to go straight (program should run indefinitely).

Amber will use a Sonar modual (Mode 1 - SRF04 Compatible Mode) trigger via the main loop and the echo should use a TC1 interrupt.

Jimmy will use a Lidar-Lite. You can choose PWM or I2C mode for the device.

Due by Dec 13 at 10am along with demo.
Nov 29    
Dec 4    
     

Reference Links:

ATmega328P Website
ATmega328P / Arduino pinout
C Quick Reference
Grove Starter Kit Reference


Determine Com Port

With Arduino plugged in to computer's USB port
Win 10 - Search for "Powershell" and open
Type - "Get-WMIObject Win32_SerialPort" (no quotes)
check results for Arduino Uno (Com __ )

Atmel Studio

Setup Strings:

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe

-C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -p atmega328p -c arduino -P COM7 -b 115200 -U flash:w:"$(ProjectDir)Debug\$(TargetName).hex":i"

Atmel Studio add ins:

Microchip Gallery

Go to above link then search for "Microchip Gallery". Click on "Download" on left side of screen and run the downloaded file (if Atmel Studio was opened when you did this, close and reopen Atmel Studio). This should now allow Atmel Studio access to plugins (TOOLS | Extensions and Updates). It is suggested in go ahead and install "Terminal for Atmel Studio"

To get printf to work with floating point values:

Project | nameofproject Properties | Toolchain : AVR/GNU Linker | General | Check "Use vprintf library(-Wl,-u,vfprintf)"
Project | nameofproject Properties | Toolchain : AVR/GNU Linker | Miscellaneous | Other Linker Flags put into textbox | "-lprintf_flt" (leave off quotes).