COSC 625- Real Time Processes
  Fall2019
ID 15982
PH 313 5:30-7:10pm

Instructor: Dr. William Sverdlik
Office: 512 Something_or_other Pray-Harrold

Office Hours: (tentative)
MW 9:00-9:50,
MW 12:00-2:00,
W 4:30-5:30
Phone: 734-487-7081
e-mail: wsverdlik@emich.edu

Textbook: No book to buy!! All material will be available from the Internet. 

Hardware: There is hardware to purchase.  Please buy the following immediately electrical items from Amazon.
Additionally, you will need to purchase a robotics kit from Tinkertech. This is a Maker's Space on MIchigan Ave. in Yp[silanti. We will be spending some time there.

Several of you will be working with Arduinos in class or on a seperate project with me. A good cheap knock-off kit with lots of experiment parts is here ($30!!)


The TinkerTech robot will cost you about $90. The $90 plus your lab fee will also get you a one month membership at the Maker's Space and will also include training and
check-out on the laser cutter.

Format:
   
There will be  a major programming project (broken up into smaller parts), and some "extra" work.
    - Quizzes/Examination: are open book, open notes.
    - Quizzes (announced) Sept 30 and Oct 21 . Open book and worth 50 points each
   
  
    - Programming Assignments:

Remote Controlled Robot
You will need to demonstrate your programs to me as  well as provide a listing of the source code. Total points = 100
Extra Stuff : (probably working alone) from time to time, I may approach you and give you some unknown piece of electronics. You will be given approximately 1 week to explain and demo this to class.(50 points)
   
Final Exam : Date??? Comprehensive . 100 points

Total points=300

Approximate Grading Scale:
    270-300    A
    240-270    B
    195-240    C
    150-195    D
    <150         E

Cheating: It violates University policy, you know....so don't do it. Cheating is defined as representing all or part of someones elses work as your own. While you are certainly encouraged to seek the advice of others in this class on assignments, the work you hand in should represent your own efforts. Violation of this rule will be dealt with according to University policy. If you are really stuck on a problem, come see the instructor!


What will happen in this class:
You will build and program a remote controlled robot. You will need to build both the robot and the remote control. Both require programming.

REFERENCES (I keep these open whenever I'm programming)

Skeleton Program (please note: all programs need to follow this format. In fact, you should **copy** this to start all programs)
Skeleton Program to read membrane keypad
Powerpoint about interrupts and timers
Instruction Set References and defined constants

sdd


Full Instruction Set Reference
Data Sheet for PIC 16F62X


SOFTWARE
Burner Software
MPLAB IDE - GUI for programming chip (new version)
Older versions of MPLAB (scroll down to MPLAB IDE archives. I like versions in the 8's)
Parallax Propscope download
Parallax Oscilliscope download


Helpful (???) Videos


A Simple Introduction to Breadboards

MPLAB X IDE (the newer version of MPLAB) - how to generate a hex file from source

Video on Timing Loops (uploaded January 19,2017    length: 26:54)
Source code to go with video


How do we get to remote controlled robot:

Assignment #1
Assignment #2
Assignment #3 due Monday November 11
Assignment #4 due Monday November 11
Assignment #5 due Wednesday November 20

1) Blink38- blink an infrared LED 38,000 times per second. You may wish to save this on a chip
2) OnOff -  flash an infrared LED On and Off  every 870 microseconds. When LED is on, it should oscillate at 38,000/second.
          This will need to be modified on the receiving end: that is, we wish to read bits at the receiver end at 870 microseconds per bit
3) Membrane keypad. Read the keypad and light up corresponding LEDS.
4) Pulse width modulation (robot). Get the robot to move
5) Interrupt driven receiver of oscillating IR.
6) Timer interrupts for pulse width modulation
7) Remote controlled robot!!


----------------------------
Everything down from here is from an old class

Programming Assignment #1 (Due: Monday January 30)- Flash an LED: on for 1 second, off for 1 second
Programming Assignment #2 (Due Monday February 6)- Demo your robot. Robot should go forward.
                                                              Forward robot: pulse for 1.7 milliseconds, off for 20 milliseconds, repeat
Programming Assignment #3 (Due Monday February 13) - Bit Banging
Programming Assignment #4 (Due Wednesday February 15) - Remote control robot !! Work in pairs. Robot
                   normally moves forward. When it detects 38kHz infrared LED, it stops. Remoce the LED and it                     moves again

Wednesday March 1 and Monday March 6 - Presentations of interrupts and timers

Programming Assignment #5 (Due: March 22,2017) Robot programming :
          a) Motor Control (Pulse Width Modulation) is controlled via timer interrupts. Timer is set to "low"                     time (20 milliseconds) and interrupt handler pulses motors high
          b) An external sensor, for now we use the robot antennaes, is hardwired to an interrupt line (line B0) and handled when triggered. Normally, the robot moves forward (see part a). When the antennaes are "triggered", the robot should move in reverse for 2 seconds and turn either left or right 30%. Then the normal program should take over (move forward).

Exam! Yes, we need to have one. Do you know the basic commands ? Can you poll a line, Can you write a timer loop ? We will have an examination on Wednesday March 29. You may bring nay printed material you like for reference; no computer access permitted.

Programming Assignment #6 (Wednesday April 10, 2017) - mystery sensor ?????



Links:


Powerpoint
USART Transmitter
USART Receiver
USART doc


Sample timer code

Harvard Architecture (wikipedia)

PICs!!!!
    Microchip - home of the PIC
    Data Sheet for the PIC 16F627/8

    PIC Training Videos!! Homework - watch them now!!
            My Notes on Video 1
   
Tutorials:
    Some quick and dirty assembler issues
    Nigel's Page   

Sample Code
Skeleton Program
Language Tutorial
IO Example 1
IO Example with interrupts
Motors, LED and Interrupts
Using FSR and INDF
    Watch Dog Timer (WDT)
   Timed Delays
    Seven Segment Display Documentation
    Seven Segment Display Code
   Code (c code) for reading an ADC0831 A/D converter
    Using Timer 0
    Pulse Width Modulation (PWM) and Servo Motors
    Analog/Digital (A/D) Conversion and Serial Peripheral Interface (SPI)



Other Topics:
    SPI - Serial Peripheral Interface (wikipedia)
    II-C Protocol (I squared C)



The following is from an old class. Just use it as a reference; we'll update as the class progresses

What to do (this is informal at this point)
    Week 1 - watch all the PIC Training Videos
            To Do; some elementary electronics
    Week 2 - start reading the tutorials. You should read thru the first 7 lessons of "You should work thru this one"
            To Do: how to use programmer, oscilliscope,
    Week 3 - finish up the rest of the tutorials and start reading Nigel's Page tutorials
            To Do: analyze timing loops
    Week 4 - serial communication, bit bashing
    Week 5 - A/D conversion, Serial Peripheral Interface(SPI)
    Week 6 - Pulse Width Modulation (PWM)
    Week 7 - Interrupts
    Week 8 - putting it all together - PWM, SPI, A/D

Tentative Dates (Winter 2014 - dates good up to 4/14/2014) :
Wednesday Januray 29, 2014 - Homework 1 due
Wednesday  February 5, 2014 - Program 1 due (flash and LED)
Wednesday February 17, 2014 - Program 2 due (7 segment LED and bit bashing)
Wednesday March 5, 2014 - Midterm Exam . Study Guide here  and here .
Monday March 10, 2014 - Program 3 (the dancing robot)

Final Project - Initial Ideas (nothing to do yet, but start thinking)

Wednesday March 13, 2014 - One page write up and presentation of your final project idea

Graduate Student Presentations

March 31 - Grad Student Presentation 1
April 2 - Grad Student Presentation 2
April 7 - Grad Student Presentation 3
April 14 - Exam 2


-----------------------------------------------------------------------------------