EE 308
Lecture Outline for Spring 2006
Wednesday 1/18
- Introduction to Microprocessors and Microcontrollers.
- Huang, Sections 1.2, 1.3
- Notes
- Course Overview
- Cruise Control Block Diagrams and Flowchart
- Block Diagrams of Simple Microprocessor and Microcontroller
- Harvard architecture and Princeton (Von Neuman) architecure microprocessor
block diagrams
- Memory map for a Princeton architecture microprocessor
Friday 1/20
- Introduction to the 9S12 Microcontroller
- Huang, Sections 1.4, 1.5
- CPU 12 Reference Manual, Sections 2.1-2.2
- MC9S12 V1.5 Core User Guide Version 1.2
- Notes
- 68HC12 Address Space
- 68HC12 ALU
- 68HC12 Programming Model
- Some 9S12 Instructions Needed for Lab
1
- A Simple Assembly Language Program
- Assembling an Assembly Language Program
Monday 1/23
- Decimal, Hexadecimal and Binary Numbers
- Notes
- Binary numbers are a code, and represent what the programmer intends for
the code
- Convert binary and hex numbers to unsigned decimal
- Convert unsigned decimal to hex
- Unsigned number line and wheel
- Signed number line and wheel
- Binary, Hex, Signed and Unsigned Decimal
- Signed number representation --- 2's Complement form
- Using the 1's complement table to find 2's complements of hex numbers
- Overflow and Carry
- Addition and subtraction of binary and hexadecimal numbers
- The Condition Code Register (CCR): N, Z, V and C bits
Wednesday 1/25
- Addition and Subtraction of Hexadecimal Numbers
- Simple assembly language programming
- Huang, Section 2.2
- HC12 Addressing Modes
- Huang, Sections 1.6 and 1.7
- Notes
- The N, Z, C and V bits of the Condition Code Register (CCR)
- Addition and Subtraction of Hex numbers
- Simple 9S12 programs
- Hex code generated from a simple 9S12 program
- Things you need to know for 9S12 assembly language programming
- HC12 Addressing Modes
- Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes
- Summary of 9S12 Addressing Modes
Friday 1/27
- More on 9S12 Addressing Modes
- Huang, Sections 1.6 and 1.7
- Notes
- The N, Z, C and V bits of the Condition Code Register (CCR)
- Addition and Subtraction of Hex numbers
- Simple 9S12 programs
- Hex code generated from a simple 9S12 program
- Things you need to know for 9S12 assembly language programming
- HC12 Addressing Modes
- Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes
- Summary of 9S12 Addressing Modes
Monday 1/30
- More on addressing modes.
- 9S12 cycles and execution time.
- AS12 Assembler Directives
- Huang, Sections 1.6 through 1.10
- Notes
- Using X and Y registers as pointers
- How to tell which branch instruction to use
- How to hand assemble a program
- Number of cycles and time taken to execute an 9S12 program
Wednesday 2/1
- AS12 Assembler Directives
- A Summary of 9S12 pnstructions
- Disassembly of 9S12 op codes
- Huang Section 1.8, Chapter 2
- MC9S12 V1.5 Core User Guide
Version 1.2, Section 12
- Notes
- A labels is a name assigned the address of the location counter where ithe
label is defined
- Use of {\tt dc} and {\tt ds} directives
- A summary of 9S12 instruction
- How to tell which branch instruction to use
Friday 2/3
- Disassembly of 9S12 op codes
- Writing an assembly language program
- Huang Sections 2.4, 2.5, 2.6
- Notes
- Disassembly of 9S12 op codes
- Use flow charts to lay out structure of program
- Use common flow structures
- if-then
- if-then-else
- do-while
- while
- Do not use spaghetti code
- Plan structure of data in memory
- Plan overall structure of program
- Work down to more detailed program structure
- Implement structure with instructions
- Optimize program to make use of instruction efficiencies
- Do not sacrifice clarity for efficiency
Monday 2/6
- Another simple program in assembly language
- Using the stack and the stack pointer
- Huang Section 4.3
- Notes
- A program to add all the odd numbers in a memory array
- Flow charts
- Assembly language program
- Assembly listing file
- Assembly map file
- The Stack and the Stack Pointer
- The stack is an area of memory used for temporary storage
- The stack pointer points to the last byte pushed onto the stack
- Some instructions which use the stack, and how data is pushed onto and
pulled off of the stack.
Wednesday 2/8
- More on programming in assembly language
- Introduction to Ports on the HC12
- Huang Sections 7.1 through 7.5
- Notes
- Good programming style
- Tips for writing programs
- Input and Output Ports
- Simplified Input Port
- Simplified Output Port
- Ports on the HC12
- PORTA, PORTB, DDRA, DDRB
- A simple program to use PORTA and PORTB
- Subroutines and the Stack
- An example of a simple subroutine
- Using a subroutine with PORTA to make a binary counter on LEDs
Friday 2/10
- Some more simple assembly language programs
- Using 9S12 input and output ports
- Huang Sections 7.2 through 7.5
- Notes
- Using a subroutine to wait for and respond to an event
- Using an input port to chech the state of DIP switches
- Using an output port to control LEDs
- An assembly language program to display a pattern on a set of LEDs
Monday 2/13
- Introduction to Programming the 9S12 in C
- Huang Sectons 5.2 and 5.3
- Notes
- Comparison of C and Assembly programs for the HC12
- How to compile a C program using the GNU-C compiler
- Using pointers to access the contents of specific addresses in C
- Using the iodp256.h header file
Wednesday 2/15
- More on Programming the 9S12 in C
- Huang Sectons 5.2 through 5.4
- Introduction to the 9S12 Hardware Subsystems
- Huang Sections 8.2-8.6
- ECT_16B8C Block User Guide
- A summary of 9S12 hardware subsystems
- Introduction to the 9S12 Timer subsystem
- Notes
- Some C basics
- Setting and clearing bits in Assembly and C
- Some simple programs in C
- Program to sum the odd numbers in an array
- Program to count the number of negative numbers in an array
- Function to delay for a given number of milliseconds
- Program to increment the LEDs connected to PORTA
- Program to display a particular pattern on PORTA
- The 9S12 has a 16-bit free-running counter to determine the time and event
happens, and to make an event happen at a particular time
- The counter is normally clocked with an 8 MHz clock
- The Timer Overflow (TOF) bit -- when the timer rolls over from
0x0000 to 0xFFFF it sets a flip-flop to show that this has
happened.
- The Timer Prescaler (PR2:0) bits of Timer Interrupt Mask 2
(TMSK2) register: Allows you to change the frequency of the clock
driving the 16-bit counter.
Friday 2/17
- Resets on the HC12
- Introduction to Interrupts on the 9S12
- Huang Sections 6.1-6.3
- MC9S12DP256B Device User Guide
- Notes
- What happens when you reset the HC12?
- Using the Timer Overflow Flag to implement a delay on the HC12
- Introduction to Interrupts
- How to generate an interrupt when the timer overflows
- How to tell the 9S12 where the Interrupt Service Routine is located
- Using interrupts on the HC12
- The 9S12 registers and stack when a TOF interrupt is received
- The 9S12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the MC9S12DP256
Monday 2/20
Wednesday 2/22
- More in Interrupts
- Huang Sections 6.1-6.4
- Notes
- Using interrupts on the 9S12
- The 9S12 registers and stack when a TOF interrupt is received
- The 9S12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the MC9S12DP256
Friday 2/24
- The Real Time Interrupt
- Huang Section 6.6
- CRG Block User Guide
- Notes
- Exceptions on the 9S12
- Using interrupts on the 9S12
- The Real Time Interrupt on the 9S12
Monday 2/27
- The 9S12 Input Capture Function
- Huang Sections 8.1-8.5
- ECT_16B8C Block User Guide
- Notes
- Interrupts on the 9S12
- Capturing the time of an external event
- The 9S12 Input Capture Function
- Registers used to enable the Input Capture Function
- Using the 9S12 Input Capture Function
- A program to use the 9S12 Input Capture in polling mode
- Using the Keyword volatile in C
- Using D-Bug12 Routines to Print Information to the Terminal
- A program to use the 9S12 Input Capture in interrupt mode
Wednesday 3/1
- The 9S12 Output Compare Function
- Huang Section 8.6
- ECT_16B8C Block User Guide
- Notes
- Review of Timer Overflow and Input Capture
- Making an event happen at a specific time on the HC12
- The 9S12 Output Compare Function
- Registers used to enable the Output Compare Function
- Using the 9S12 Output Compare Function
- A program to use the 9S12 Output Compare to generate a square wave
- Setting and clearing bits in the Timer Subsystem
- Introduction of Pulse Width Modulation
Friday 3/3
- The 9S12 Pulse Width Modulation System
- Huang Sections 8.10 and 8.11
- PWM_8B8C Block User Guide
- Notes
- What is Pulse Width Modulation
- The 9S12 Pulse Width Modulation system
- Registers used by the PWM system
- How to set the period for PWM Channel 0
- How to set the clock for PWM Channel 0
- Interdependence of clocks for Channels 0 and 1
- PWM Channels 2 and 3
- Using the 9S12 PWM
- A program to use the 9S12 PWM
Monday 3/6
- Analog-to-Digital Converters
- Huang Sections 12.1-12.2
- Notes
Wednesday 3/8
- The 9S12 A/D converter
- Huang Section 12.3-12.4
- ATD_10B8C Block User Guide
- Notes
Friday 3/10
- Introduction the Serial Communications
- Huang Sections 9.2, 10.2
- SCI Block User Guide
- SPI Block User Guide
- Notes
Monday 3/20
- The 9S12 Serial Peripheral Inteface (SPI)
- Huang Section 10.2 through 10.6
- SPI Block User Guide
- Notes
Wednesday 3/22
- More on the 9S12 SPI
- Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI
- Notes
- DS1302 Data Sheet
Friday 3/24
Monday 3/27
Wednesday 3/29
Friday 3/31
Monday 4/3
Wednesday 4/5
Friday 4/7
Monday 4/10
Wednesday 4/12
- Preparation for Final Lab Project
- Simple Motor Control
- Notes
Monday 4/17
- What's on the 9S12 bus as it executes a program
- The 9S12 Serial Communications Interface
- 9S12 Serial Communications Interface (SCI) Block Guide V02.05
- Huang, Sections 9.2-9.6
- Notes
Wednesday 4/19
- The 9S12 Serial Communications Interface
- 9S12 Serial Communications Interface (SCI) Block Guide V02.05
- Huang, Sections 9.2-9.6
- Notes
Fiday 4/21
Monday 4/24
Wednesday 4/26
- The 9S12 Pulse Accumulator
- ECT_16B8C Block User Guide
- Huang, Sections 8.7
- Notes
Friday 4/28
Monday 5/1
- Survey of Microcontrollers
- Notes
Wednesday 5/3
- Review for Final Exam
- Notes
Friday 5/5
- Review for Final Exam
- Notes
Monday 5/8
Note: The lecture figures are presented in Adobe Acrobat format. You need to
open them using the Adobe Acrobat Reader program. This is a free program
available from Adobe:
Bill Rison,
<rison@ee.nmt.edu >