EE319K Introduction to Embedded Systems, Spring 2010 (5/10/10 version)
Course Catalog Description Embedded systems; machine language execution; assembly language programming; local variables; input/output synchronization; analog to digital conversion, digital to analog conversion; debugging; and interrupts.
Overview
  EE319K will continue the bottom-up educational approach, started in EE302 and EE306. The overall educational objective is to allow students to discover how the computer interacts with its environment. It will provide hands-on experiences of how an embedded system could be used to solve EE problems. The focus will be understanding and analysis rather than design. The analog to digital converter (ADC) and digital to analog converter (DAC) are the chosen mechanism to bridge the CE and EE worlds. EE concepts include Ohms Law, LED voltage/current, resistance measurement, and stepper motor control. CE concepts include I/O device drivers, debugging, stacks, FIFO queues, local variables and interrupts. The hardware construction is performed on a breadboard and debugged using a multimeter (students learn to measure voltage and resistance). Software is developed in Freescale 9S12 assembly; 3 out of the 9 labs are simulated-only in TExaS and other 6 are first simulated on TExaS then run on the real 9S12. Software debugging occurs during the simulation stage. Verification occurs in both stages. Labs 1 through 5 are written in 9S12 assembly language. Labs 6 through 10 are written in a combination of assembly and C.
Class: ACA 1.104, Monday, Wednesday, Friday 2-2:50pm    Lab: ACA 1.106
Office Hours: Monday 11:15am-12noon, Wednesday 1-1:45pm, Friday  12noon-12:45pm
Instructor: Jonathan W. Valvano, ENS627, 471-5141
email valvano@mail.utexas.edu  (put "EE319K" in the email title, send no ZIP files)  
Web page http://users.ece.utexas.edu/~valvano 
Lecture notes and lab assignments http://users.ece.utexas.edu/~valvano/EE319K
Data sheets http://www.ece.utexas.edu/~valvano/Datasheets  
Starter files http://www.ece.utexas.edu/~valvano/Starterfiles 
Unique Numbers:  16130 Th2-3, 16135 Th3-4, 16140 Th4-5
Text: Introduction to Embedded Systems: Interfacing to the Freescale 9S12, Cengage Publishing 2009, ISBN-10: 049541137X | ISBN-13: 9780495411376, by J. W. Valvano,  Cengage Learning Publisher's Website list of textbook errors
Equipment to buy: You will need a voltmeter (one less than $20 will do), soldering iron (with solder), and a wire stripper. Due to the lead in most solder, please wash your hands after soldering, before eating or drinking. We will be giving you a 9S12DP512 development board, a prototyping board, and some external components. If you are pregnant or think you might be pregnant, have someone else do the soldering.
TAs:                 
     (TA) Evgeni Krimer, ekrimer@ece.utexas.edu
     (TA) Fábio Fernandes, fabiogf@gmail.com 
     (TA) Eshwaran Kumar, eshwaran.vijayakumar@mail.utexas.edu
     (TA) Mehmet Basoglu, mbasoglu@gmail.com 
     (TA) Karthik Sankar, krsankar@mail.utexas.edu 
Reference materials: Data sheets for most of the devices used in this class are available as pdf files on my web site. Please make sure you have access to the CPU12 instruction manual, either in print (from 2nd floor lab or in my office) or pdf form. You should download these data sheets and have them available when you are developing code
32 page CPU12 quick reference CPU12rg.pdf 
458 page CPU12 programming reference S12CPUV2.pdf 
9S12DP512 datasheet MC9S12DP512.pdf
Tech arts board information TechArts9S12DP512.pdf

Short Movies describing TExaS http://users.ece.utexas.edu/~valvano/Readme.htm
Web videos of the Example lessons from the book  

Prerequisites: EE306 and EE312 with a grade of C or better. There will be no re-tests, make-ups, or incompletes.
Teaching philosophy
I strongly encourage students to take an active role in this class.  Questions are welcome before, during and after class. Please feel free to email, visit or call me if you have questions.
Detailed Objectives of EE319K
0) Understanding how the computer stores and manipulates data (characters, integers, and fixed-point numbers), the basic arithmetic and logical operations performed by the computer,
1) The understanding of embedded systems (a system with the computer hidden inside) using modular design and abstraction,
2) Assembly language and C programming: considering both function and style,
3) Understanding how the computer executes instructions (fetch opcode, fetch operand, read data, operate, and write data)
4) The use of a microcontroller (strategic use of RAM ROM and I/O) Microcontrollers typically have a little RAM and a lot of ROM. Globals, locals and the heap go in RAM. Constants and programs go in ROM.
5) Debugging and verification using a simulator and on the microcontroller (embedded systems typically do not have a print function) debugging techniques such as breakpoints, scanpoints, profiles, monitors, voltmeters, oscilloscopes, logic analyzers
6) How input/output actually happens (the students wire up analog and digital signals to the 9S12 and measure them with a voltmeter), synchronization,  including switches, LEDs, LCDs, DACs, ADCs, and serial ports,
7) The implementation of an I/O driver (a set of programs that perform input/output)
8) Understanding, from an architecture standpoint, how local variables and parameters work (e.g., a space on the stack is dynamically created, the local variable is accessed using stack-pointer relative addressing, then the space is deallocated.)
9) Analog to digital conversion (ADC) e.g., the students interface a slide potentiometer to the ADC, and write software that measures the position of the slide, creating a display like “1.23 cm”
10) Interrupt synchronization, real-time ADC sampling (periodic timer interrupts), introduction to multithreaded programming
11) Simple motors (e.g., open and closed-loop stepper motor control)
12) Digital to analog conversion (DAC), used to make simple sounds
13) Design and implementation of elementary data structures, such as linked lists, stacks and queues.
After the successful conclusion of EE319K students should be able to understand the basic components of a computer, write assembly language programs that perform I/O functions and implement simple data structures, manipulate numbers in multiple formats, and understand how software uses global memory to store permanent information and the stack to store temporary information.
Grading:
30% Laboratory assignments, due on Thursday (when performed in groups of  2, one solution turned in)

    10% Homework assignments (on line and programming practice), usually due on Fridays  

    15% In class Exam 1, Wednesday February 24, 2-2:50am, ACA 1.104
    20% In lab
Exam 2, Wednesday, March 31, 2 to 3:30 (if you have a 3-4 class, let me know), ACA 1.102, in large lab
    25
% Final, Monday May 17, 2-5pm, CPE 2.208, regularly scheduled time and place
Cutoff scores for the corresponding letter grades will not be determined until after the final exam.  
Attendance: Students are expected to attend lectures. The book covers more information than the class, and we will use lectures to map our way through the book. If you miss class you may find it difficult to catch up.  

Spring 2010 Lab Schedule (labs due on Thursday, and Labs 1-8 are demonstrated to the TA)

1/21   

   

Go to ACA 1.106 for lab grading policy and demonstration

1/28  

   

Go to ACA 1.106 for TExaS demonstration

2/4   

Lab 1

Digital Lock I/O, parallel port, direction register and logical function, written in assembly (simulated, individual)

2/11  

 

Real board demonstration, bring your board to lab

2/18 Lab 2 LED flashing, written in assembly (simulated and board, individual)

2/25   

 

Go to ACA 1.106 for debugging help

3/4 Lab 3 Debugging Techniques, one switch, one LED, written in assembly (simulated and board, individual)

3/11

Lab 4 Traffic Light Controller using the real 9S12, written in assembly (simulated and board, groups of two)

3/25   

Lab 5 

LCD device driver, decimal fixed-point output, local variables, written in assembly (simulated and board, groups of two)

4/1 

 

Go to ACA 1.106 for a Metrowerks demonstration, how to compile then simulate in TExaS

4/8   

Lab 6

Real-time Position Monitor, ADC, interrupts, LCD, mixture of assembly and C (simulated and board, groups of two)

4/15  

Lab 7

Distributed DAS, serial port interrupts, FIFO queue, mixture of assembly and C (simulated and board, groups of two)

4/22   

Lab 8

Digital Piano using a 4-bit DAC, C (simulated and board, groups of two)

4/29   

  Go to ACA 1.106 for debugging help

5/4   

Lab 9

10pm Lab 9 due, uploaded onto Blackboard, there is no late turn in for Lab 9.

5/5   

Lab 9

TRobot Finals, mixture of assembly and C  (in class) (simulated, groups of one or two) (due 10pm 5/4 via Blackboard)

The following schedule is preliminary, please check the web for the most recent version.
Date Reading Assignment Topic
1/20 Chapter 1 aLec01, course description, flow charts, data flow graphs, call graphs
1/22 Appendix 1.1 through 1.8.2 aLec02, using the TExaS simulator, design of a NOT gate
1/25 Chapters 2 and 3 aLec03, numbers, hexadecimal,  TExaS ViewBox and help system
1/27 Chapters 2 and 4 aLec04, 9S12 architecture, registers, simple addressing modes, memory allocation
1/29 Chapter 2 aLec05, stack, subroutines, execution, parallel ports, direction registers
2/1 Chapter 3 aLec06, logical, shift, introduction to addition and subtraction
2/3 Sections 4.6 and 5.8 aLec07, Debugging in TExaS
2/5 Chapters 3 and 5 aLec08, Arithmetic operations, condition code bits, if-then
2/8 Appendix 2 aLec09, Demonstration of the board (bring your board to class)
2/10 Section 2.6 aLec09, Switch input and LED output, real board, voltmeter debugging
2/12 Section 5.1, 5.2, 5.6, 6.11 aLec10, Loops, modular design, subroutines, debugging dump
2/15 Sections 6.1, 6.2, 6.3 aLec11, pointers using indexed addressing, array
2/17 Sections 6.1, 6.2, 6.3 aLec11, pointers using indexed addressing, array
2/19 Sections 4.4, 5.8 aLec12, Timer, Functional debugging
2/22 Chapters 1-5 aLec13, Exam 1 review,
2/24 Chapters 1-5 Exam 1 (closed book) Room ACA 1.104
2/26 Sections 6.11 aLec14, Finite state machines
3/1 Sections 6.8 aLec15, Finite state machines
3/3 Sections 7.1-7.4, 9.1 aLec16, Local variables, fixed-point numbers, floating point, ASCII,
3/5 Sections 7.1-7.4, 10.5 aLec17, Local variables, LCD interface
3/8 Sections 10.1, 8.4 aLec18, LCD interface, fixed-point conversions
3/10    
3/12 Sections 9.1, 9.2, 9.4, 9.6 aLec19, Timer, introduction to interrupts
3/22 Section 9.6 aLec20, Output compare interrupts, debugging interrupt systems
3/24   aLec21, Metrowerks
3/26 Section 10.2 aLec22, C/assembly interface, numerical calculations , emul ediv
3/29 Section 11.1, 11.4 aLec23, Device driver, Metrowerks debugging, analog to digital conversion
3/31 Chapters 1-6 Exam 2 (closed book) in ACA 1.102, 2-3:30pm
4/2 Sections 9.6, 10.1, 11.4 aLec24, Lab 6 hints, design method, tables
4/5 Section 8.1 aLec25, SCI interface, interrupts
4/7 Sections 12.1-12.4 aLec26, Serial port interrupts,  Fifo queue
4/9    
4/12 Sections 12.1-12.4 aLec27, Real time systems, latency, priority, Fifo queue
4/14 Section 11.2 aLec28, Digital to analog conversion
4/16 Section 11.3 aLec29, Sound generation
4/19 Section 8.7 aLec31, Stepper motors
4/21   aLec32, Introduction to TRobots
4/23   aLec30, Debugging in Metrowerks C,
4/26   C programming, structures
4/28   C programming
4/30   EE345L review, future of embedded systems
5/3   aLec35, Systems engineering
5/5 Lab 9 due 5/4 10pm TRobots competition finals, who is the best programmer?
5/7 Chapters 1-13 aLec36, final exam review

Computer Usage: Computers in LRC complex are available for your usage. Sign up procedures are those established by the LRC. TA's in the laboratory are checking off programs and supervising while on duty, thus you can expect to have only a brief consultations with them. You should learn to develop software while on the computer. This course involves some projects that require extended periods of time to complete and a project cannot be done just overnight. Get started on an assignment early so you can get help if you need it. There are ample machine hours to give everyone more than enough time to complete each program. However, expect the laboratory to be crowded and machine time to be scarce if you attempt to work in the lab a day or two before an assignment is due. You will be competing with students in other courses for computer time. We need your assistance in the laboratory. Please report any equipment problems to the TA if they are present. If a TA is not present use the form provided in the lab. If you do this we can rapidly get repair service. Please help to keep the lab clean.
Laboratory policies: This is a programming class. Therefore, the quality of the software you write will significantly affect your grade. In addition to writing software, each lab has specific activities that must be documented and turned in with the lab. These deliverables will be screen shots, circuit diagrams, measurements or data analyses. When you get the program finished, make a printout of your assembly listing, all deliverables, and staple a grading sheet to the front, and then demonstrate it to a TA. The TA will record the performance and demonstration grades on the grading sheet. Labs are due during your scheduled lab period on Thursday. Late assignments incur a penalty of 10% of the maximum score per day for the first three days and will not be accepted afterwards. Exceptionally "good" programs may be given extra credit. If you do extra functions in your program, point out and demonstrate the extra functions to the TA when you demonstrate your program. Partial credit, not to exceed a maximum of 75% of full credit, may be awarded to a program that does not meet all specifications. Often it is better to demonstrate an incomplete program, rather than incur late penalties while fixing all its bugs. The specific grading policies for labs can be found in the lab manual.
 
Lab Partners: The first 3 labs must be performed individually. Lab 1 will be collected on a first come first served basis. For Labs 2 and 3 you will be assigned a 5-minute checkout time during the regularly scheduled lab period. If you are late or miss your slot your grade will likely be lower because you will not have time to present your lab to the TA. You will work in a group of two for the remaining labs. The TA will randomly select partners for Lab 4 to 8, and the partnerships will be rotated week to week. The TA will assign each partnership a 10-minute checkout time during the regularly scheduled lab period. In cases where there are an odd number of students in a section, we will attempt to create a partnership with another section and assign a 10-minute checkout time convenient for both students and the TA. Note that we cannot guarantee that you will have a partner for each of the labs. Both partners must be present during the TA demonstration. If you and your partner did not get along, you are still both responsible for the lab. The TA may assign a different grade to each partner based on your performance during your checkout demonstration. You will be allowed to choose your own partner for Lab 9.
EE319K kit handed out by Daryl Goodnight (2nd floor) and do not need to be returned (however we will expect you to use this board subsequently if you take EE345L and/or EE345M)
 
9S12DP512 board
  Power adapter
  RS232 9-pin cable
  Protoboard
EE319K kit handed out by TAs
and do not need to be returned
 
1 7406
  6 LED (20 mA, red yellow, green)
  6 220 ohm 5%, 0.25 watt resistors
  3 push-button switches
  3 10k ohm 5%, 0.25 watt resistors
  3 1.5k ohm 5%, 0.25 watt resistors
  3 12k ohm 5%, 0.25 watt resistors
  18 inches of 6-wire 24 gauge cable, cut apart and use the wire for your circuits
  1 0.1 uF ceramic bypass cap
  1 headphone jack
  1 20k ohm slide pot
Item to get from long term checkout
 
1 LCD display and serial cable (if you check out either of these two and do not return them, we will reduce your overall grade in EE319K one letter grade)

Should you buy a computer? Let it be perfectly clear that the following remarks are my personal opinion, and do not reflect an official position of the department, college, or university. I feel very strongly that you should have your own computer on which you develop your software and write your reports. I think both software development and report writing should be done without paper, pencil and erasers. Having a computer at home allows you to organize your information (files, directories etc.) as well as your schedule (allocate your software development time for that the time of day during which you are most creative and energetic.) Physiologically most people are more energetic in the morning. On the other hand, there are fewer distractions late at night.
Which computer should I buy? In EE319K, we write assembly language programs for the 9S12 using a simulator which runs on an IBM-PC compatible running Windows 2000, XP or Vista. Many applications do not work properly on Vista, so I advise you put off upgrading to Vista if you can. The software development system will run on most PC's. I think the more money you invest, the happier you'll be.
TEXAS.EXE The simulator application, called Test EXecute And Simulate, is not freeware, so please don't post it on the net or otherwise send it to others. On the other hand, I grant EE319K students indefinite usage of the software, including installing the application on each of your personal computes. If you know of someone interested in the application have them contact me directly. It is the eighth semester we will be using the application in EE319K, but I will be make an updates to fix bugs or add features. Please work through the tutorials and examples to bring you up to speed on the various aspects of the system. Instructions for installing/upgrading TExaS will be provided on Blackboard. The TExaS application itself runs on Vista, but the help system does not run on Vista without a patch. Ask your TA how to get the TExaS help system to run under Vista.
Legal Stuff: The 12th class day is January 29. After this date, I will sign a drop only if the Dean approves it. Your current grade status must be a "C" or better for you to receive a "Q". Course evaluation is conducted on the last class day in accordance with the Measurement and Evaluation Center form. The final exam is at the time and place stated in the course schedule. The University of Texas at Austin provides upon request appropriate academic adjustments for qualified students with disabilities. For more information, contact the Office of the Dean of Students with Disabilities at 471-6259, 471-4241 TDD.
Cheating: "Faculty in the ECE Department are committed to detecting and responding to all instances of scholastic dishonesty and will pursue cases of scholastic dishonesty in accordance with university policy. Scholastic dishonesty, in all its forms, is a blight on our entire academic community. All parties in our community -- faculty, staff, and students -- are responsible for creating an environment that educates outstanding engineers, and this goal entails excellence in technical skills, self-giving citizenry, an ethical integrity. Industry wants engineers who are competent and fully trustworthy, and both qualities must be developed day by day throughout an entire lifetime. Scholastic dishonesty includes, but is not limited to, cheating, plagiarism, collusion, falsifying academic records, or any act designed to give an unfair academic advantage to the student. The fact that you are in this class as an engineering student is testament to your abilities. Penalties for scholastic dishonesty are severe and can include, but are not limited to, a written reprimand, a zero on the assignment/exam, re-taking the exam in question, an F in the course, or expulsion from the University. Don't jeopardize your career by an act of scholastic dishonesty. Details about academic integrity and what constitutes scholastic dishonesty can be found at the website for the UT Dean of Students Office and the General Information Catalog, Section 11-802." 
You are allowed to talk to your classmates about the lab assignments, but you are NOT allowed to look at each other's written work. Oral discussion about an assignment is encouraged and is not considered to be cheating. Copying of any part of a program is cheating without explicit reference to its source. If we find two programs that are copied, there will be a substantial penalty to both students, e.g., failure in the course. Students who cheat on tests or in lab will fail. Prosecution of cases is very traumatic to both the student and instructor. It is appropriate to use software out of the book, class website as long as all copy-pasted software is explicitly referenced. Copy-pasting software from current or past EE319K students is scholastic dishonesty. Policies concerning the use of other people's software in this class:
    · I strongly encourage you to study existing software.
    · All applications and libraries must be legally obtained. E.g.,
        You may use libraries that came when you bought a compiler.
        You may use software obtained from the web.
        You may copy and paste from the existing source code.
    · You may use any existing source code that is clearly referenced and categorized:
        original: completely written by you,
        derived: fundamental approach is copied but it is your implementation,
        modified: source code significantly edited to serve your purpose,
        copied: source code includes minor modifications.
Curious about my research? See http://users.ece.utexas.edu/~valvano/research 
Homework
Nine homework assignments will be submitted on line and three or four assignments will be submitted in class. You must work on the in class homework individually. However, for the online homework, you can work together in groups of any size, but everyone enters a separate online solution. Other than breaking into the system and changing grades, you may get as much help from anyone in any way you please to complete the online homework.
STEP 1:
Log into the Quest Homework Service at the URL https://quest.cns.utexas.edu/student/   Click Get Started, log into with UT EID, you should see EE319K as one of the choices  
STEP 2:

Download: Students' Instructions
Download:     First Homework   
STEP 3: Work one homework question.  Log in again and submit its answer before next class period.
STEP 4: Continue submitting answers until due time.
STEP 5: Download the solutions after due time.


There will be a signup for Lab checkout times. Each student will have a specific checkout time which will be when their lab will be demonstrated to their TA.

HW1 hints:
Microcontroller - see glossary for definition
Microprocessor - see "processor" in Figure 1.1
Microcomputer - see glossary for definition
IBM-PC is not a microprocessor
 The newest version of TExaS is available (UPGRADE to latest version). There are also install CDs that you can checkout from the 2nd floor lab.