EE 308
Lecture Outline for Spring 2005
Wednesday 1/19
- 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/21
- Introduction to the HC12 Microcontroller
- Huang, Sections 1.4, 1.5
- CPU 12 Reference Manual, Sections 2.1-2.2
- Notes
- 68HC12 Address Space
- 68HC12 ALU
- 68HC12 Programming Model
- Some HC12 Instructions Needed for Lab
1
- A Simple Assembly Language Program
- Assembling an Assembly Language Program
Monday 1/24
- 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/26
- 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 HC12 programs
- Hex code generated from a simple HC12 program
- Things you need to know for HC12 assembly language programming
- HC12 Addressing Modes
- Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes
- Summary of HC12 Addressing Modes
Friday 1/28
- More on addressing modes and HC12 instructions.
- 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 HC12 program
Monday 1/31
- Assembler Directives of the Cosmic Assembler
- A Summary of HC12 Instructions
- Huang Section 1.8, Chapter 2
- CPU 12 Reference Manual, Chapter 5
- Notes
- Cosmic Assembler Directives
- 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 HC12 instruction
- How to tell which branch instruction to use
Wednesday 2/2
- Disassembly of HC12 op codes
- Writing an assembly language program
- Huang Sections 2.4, 2.5, 2.6
- Notes
- Disassembly of HC12 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
Friday 2/4
- 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.
Monday 2/7
- 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
Wednesday 2/9
- Some more simple assembly language programs
- Using HC12 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
Friday 2/11
- Introduction to Programming the HC12 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 Cosmic compiler
- Using pointers to access the contents of specific addresses in C
- Using the iodp256.h header file
Monday 2/14
- More on Programming the HC12 in C
- Huang Sectons 5.2 through 5.4
- Introduction to the HC12 Hardware Subsystems
- Huang Sections 8.2-8.6
- ECT_16B8C Block User Guide
- A summary of HC12 hardware subsystems
- Introduction to the HC12 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 HC12 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.
Wednesday 2/16
- Resets on the HC12
- Introduction to Interrupts on the HC12
- Huang Section 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 HC12 where the Interrupt Service Routine is located
- Using interrupts on the HC12
- The HC12 registers and stack when a TOF interrupt is received
- The HC12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the 68HC912B32
Friday 2/18
- More in Interrupts
- Review for Exam 1
- Notes
- Using interrupts on the HC12
- The HC12 registers and stack when a TOF interrupt is received
- The HC12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the 68HC912B32
Monday 2/21
Wednesday 2/23
- The Real Time Interrupt
- Huang Sections 6.2 and 8.7
- CRG Block User Guide
- Notes
- Exceptions on the HC12
- Using interrupts on the HC12
- The Real Time Interrupt on the HC12
Friday 2/25
- The HC12 Input Capture Function
- Huang Section 8.5
- ECT_16B8C Block User Guide
- Notes
- Interrupts on the HC12
- Capturing the time of an external event
- The HC12 Input Capture Function
- Registers used to enable the Input Capture Function
- Using the HC12 Input Capture Function
- A program to use the HC12 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 HC12 Input Capture in interrupt mode
Monday 2/28
- The HC12 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 HC12 Output Compare Function
- Registers used to enable the Output Compare Function
- Using the HC12 Output Compare Function
- A program to use the HC12 Output Compare to generate a square wave
- Setting and clearing bits in the Timer Subsystem
- Introduction of Pulse Width Modulation
Friday 3/4
- The HC12 Pulse Width Modulation System
- Huang Sections 8.8 and 8.9
- PWM_8B8C Block User Guide
- Notes
- What is Pulse Width Modulation
- The HC12 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 HC12 PWM
- A program to use the HC12 PWM
Monday 3/7
- More on the HC12 Pulse Width Modulation System
- Huang Sections 8.8 and 8.9
- PWM_8B8C Block User Guide
- Notes (Same as for Friday, 3/4)
Wednesday 3/9
- Analog-to-Digital Converters
- Huang Chapter 10
- Notes
Friday 3/11
- The HC12 A/D converter
- Huang Chapter 10
- ATD_10B8C Block User Guide
- Notes
Monday 3/21
- Introduction the Serial Communications
- Huang Section 9.2
- SCI Block User Guide
- SPI Block User Guide
- Notes
Wednesday 3/23
- The HC12 Serial Peripheral Inteface (SPI)
- Huang Section 9.6 through 9.8
- SPI Block User Guide
- Notes
Monday 3/28
Wednesday 3/30
Friday 4/1
Monday 4/4
- The HC12 in Expanded Mode
- Huang Chapter 13
- M68HC12B Family Manual, Section 5
- Notes
Wednesday 4/6
- The HC12 in Expanded Mode - External Ports
- Huang Chapter 13
- M68HC12B Family Manual, Section 5
- Notes
Friday 4/8
- The HC12 in Expanded Mode - How to get into expanded mode
- Huang Chapter 13
- M68HC12B Family Manual, Section 5
- Notes
Monday 4/11
- The HC12 in Expanded Mode - Timing
- Huang Chapter 13
- M68HC12B Family Manual, Section 5
- Notes
Wednesday 4/13
- The HC12 in Expanded Mode - Using MSI logic to build ports
- Huang Chapter 13
- M68HC12B Family Manual, Section 5
- Notes
Friday 4/15
- Preparation for Final Lab Project
- Simple Motor Control
- Notes
Monday 4/18
- The HC12 Serial Communications Interface
- HCS12 Serial Communications Interface (SCI) Block Guide V02.05
- Pack and Barrett, Sections 10.2-10.4
- Notes
Wedesday 4/20
- The HC12 Pulse Accumulator
- ECT_16B8C Block User Guide
- Pack and Barrett, Sections 10.2-10.4
- Notes
Friday 4/22
Monday 4/25
Wednesday 4/27
Friday 4/29
- Timing in Expanded Mode
- Notes
Monday 5/2
Wednesday 5/4
Friday 5/6
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 >