EE 308
Lecture Outline for Spring 2010
Wednesday 1/20
- 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
Friday 1/22
- Introduction to the MC9S12 Microcontroller
- Huang, Sections 1.4, 1.5
-
S12CPUV2 Reference Manual, Sections 2.1 - 2.5.
- Notes
- Harvard architecture and Princeton (Von Neuman) architecure microprocessor
block diagrams
- Memory map for a Princeton architecture microprocessor
- 68HC12 Address Space
- 68HC12 ALU
- 68HC12 Programming Model
- Some MC9S12 Instructions Needed for Lab
1
- A Simple Assembly Language Program
- Assembling an Assembly Language Program
Monday 1/25
- Simple assembly language programming
- Huang, Section 2.2
- HC12 Addressing Modes
- Huang, Sections 1.6 and 1.7
- S12CPUV2 Reference Manual, Section 3.
- Notes
- A Simple Assembly Language Program
- Assembling an Assembly Language Program
- Simple MC9S12 programs
- Hex code generated from a simple MC9S12 program
- Things you need to know for MC9S12 assembly language programming
- HC12 Addressing Modes
- Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes
- Summary of MC9S12 Addressing Modes
Wednesday 1/27
- More on MC9S12 Addressing Modes
- Huang, Sections 1.6 and 1.7
- S12CPUV2 Reference Manual, Section 3.
- Instruction coding and execution
- Notes
- Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes
- Summary of MC9S12 Addressing Modes
- 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 MC9S12 program
Friday 1/29
- MC9S12 Assembler Directives
- A Summary of MC9S12 Instructions
- Disassembly of MC9S12 op codes
- Huang Section 1.8, Chapter 2
- S12CPUV2
Reference Manual, Section 5.
- Notes
- Number of cycles and time taken to execute an MC9S12 program
- A label is a name assigned the address of the location counter where ithe
label is defined
- Use of {\tt as12} assembler directives
- A summary of MC9S12 instruction
- How to disassemble an MC9S12 instruction sequence
Monday 2/1
- Disassembly of MC9S12 op codes
- Decimal, Hexadecimal and Binary Numbers
- S12CPUV2
Reference Manual, Section 5.
- Notes
- How to disassemble an MC9S12 instruction sequence
- 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
- 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 2/3
- Writing an assembly language program
- Huang Sections 2.4, 2.5, 2.6
- Notes
- Disassembly of MC9S12 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/5
- More on programming in assembly language
- Introduction to Ports on the HC12
- Huang Sections 7.1 through 7.5
- Notes
- Input and Output Ports
- Simplified Input Port
- Simplified Output Port
- Simplified Input/Output Port
- PORTA, PORTB, DDRA, DDRB
- A simple program to use PORTA and PORTB
- Good programming style
- Tips for writing programs
- A program to average the numbers in a memory array
- Flow charts
- Assembly language program
- Assembly listing file
Monday 2/8
- Using the stack and the stack pointer
- Huang Section 4.3
- Notes
- 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.
- Subroutines and the Stack
- An example of a simple subroutine
- Using a subroutine with PORTA to make a binary counter on LEDs
Wednesday 2/10
- An Example of Using the Stack
- Notes
- An example of using the stack
- Including hcs12.inc in assembly language programs
- Using a mask in assembly language programs
- Using a subroutine with PORTA to make a binary counter on LEDs
Friday 2/12
- Introduction to Programming the MC9S12 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
Monday 2/15
- More on Programming the MC9S12 in C
- Huang Sectons 5.2 through 5.4
- Introduction to the MC9S12 Hardware Subsystems
- Huang Sections 8.2-8.6
- ECT_16B8C Block User Guide
- A summary of MC9S12 hardware subsystems
- Introduction to the MC9S12 Timer subsystem
- Notes
- Some C basics
- Setting and clearing bits in Assembly and C
- Some simple programs in C
- 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 MC9S12 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/17
- More on Programming the MC9S12 in C
- Huang Sectons 5.2 through 5.4
- Introduction to the MC9S12 Hardware Subsystems
- Huang Sections 8.2-8.6
- ECT_16B8C Block User Guide
- A summary of MC9S12 hardware subsystems
- Introduction to the MC9S12 Timer subsystem
- Resets on the HC12
- Introduction to Interrupts on the MC9S12
- Huang Sections 6.1-6.3
- MC9S12DP256B Device User Guide
- Notes
- The MC9S12 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.
- What happens when you reset the HC12?
- Introduction to Interrupts
Friday 2/19
- Interrupts and the Timer Overflow Interrupt
- Huang Sections 6.1-6.4
- Notes
- 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 MC9S12 where the Interrupt Service Routine is located
- Using interrupts on the HC12
- The MC9S12 registers and stack when a TOF interrupt is received
- The MC9S12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the MCMC9S12DP256
- Using interrupts on the MC9S12: Assembly and C
- The MC9S12 registers and stack when a TOF interrupt is received
- The MC9S12 registers and stack just after a TOF interrupt is received
- Interrupt vectors for the MC9S12DP256
Monday 2/22
- The Real Time Interrupt
- Huang Section 6.6
- CRG Block User Guide
- Notes
- Exceptions on the MC9S12
- Using interrupts on the MC9S12
- The Real Time Interrupt on the MC9S12
Wednesday 2/24
Friday 2/26
- The MC9S12 Output Compare Function
- Huang Section 8.6
- ECT_16B8C Block User Guide
- Notes
- Interrupts on the MC9S12
- Making an event happen at a specific time on the HC12
- The MC9S12 Output Compare Function
- Registers used to enable the Output Compare Function
- Using the MC9S12 Output Compare Function
- A program to use the MC9S12 Output Compare to generate a square wave
- Setting and clearing bits in the Timer Subsystem
Monday 3/1
- The MC9S12 Input Capture Function
- Huang Sections 8.1-8.5
- ECT_16B8C Block User Guide
- Notes
- Capturing the time of an external event
- The MC9S12 Input Capture Function
- Registers used to enable the Input Capture Function
- Using the MC9S12 Input Capture Function
- A program to use the MC9S12 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 MC9S12 Input Capture in interrupt mode
Wednesday 3/3
- The MC9S12 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 MC9S12 Output Compare Function
- Registers used to enable the Output Compare Function
- Using the MC9S12 Output Compare Function
- A program to use the MC9S12 Output Compare to generate a square wave
- Introduction to Pulse Width Modulation
Friday 3/5
- The MC9S12 Pulse Width Modulation System
- Huang Sections 8.10 and 8.11
- PWM_8B8C Block User Guide
- Analog-to-Digital Converters
- Huang Sections 12.1-12.2
- Notes
- What is Pulse Width Modulation
- The MC9S12 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 MC9S12 PWM
- A program to use the MC9S12 PWM
- Introduction to A/D Converters
Monday 3/8
- Analog-to-Digital Converters
- Huang Sections 12.1-12.2
- Notes
- Review of MC9S12 Pulse Width Modulation subsystem
- Introduction to A/D Converters
Wednesday 3/10
- The MC9S12 A/D converter
- Huang Section 12.3-12.4
- ATD_10B8C Block User Guide
- Notes
Friday 3/12
- Dragon12 LCD Display
- Huang Section 7.8
- Hantronix_LCD2.PDF data sheet (from Dragon12 CD-ROM)
- Notes
- Using the Dragon12 LCD display
Monday 3/22
- Introduction the Serial Communications
- Huang Sections 9.2, 10.2, 11.2
- SCI Block User Guide
- SPI Block User Guide
- IIC Block User Guide
- Notes
- Parallel vs Serial Communcation
- Synchronous and Asynchronous Serial Communication
- Descripiton of the SPI (Serial Peripheral Interface) protocol
- Descripiton of the IIC (Inter-Integrated Circuit) protocol
Wednesday 3/24
- Using the MC9S12 IIC Bus with the DS 1307 Real Time Clock
- Huang Sections 11.3-11.6
- IIC Block User Guide
- DS1307 Data Sheet
- Notes
- The IIC bus on the MC9S12
- MC9S12 registers used with the IIC bus
- How to write data to a slave and read data from a slave
- The Dallas Semiconductor DS 1307 Real Time Clock
Friday 3/26
- Review for Exam 2
- Using the MC9S12 IIC Bus with the DS 1307 Real Time Clock
- DS1307 Data Sheet
- The MC9S12 Serial Communications Interface
- MC9S12 Serial Communications Interface (SCI) Block Guide V02.05
- Huang, Sections 9.2-9.6
- Notes
Monday 3/29
Wednesday 3/31
- Using the MC9S12 IIC Bus with the DS 1307 Real Time Clock
- DS1307 Data Sheet
- Asynchronous Serial Communications
- The MC9S12 Serial Communications Interface
- MC9S12 Serial Communications Interface (SCI) Block Guide V02.05
- Huang, Sections 9.2-9.6
- Notes
Monday 4/5
Wednesday 4/7
Friday 4/9
Monday 4/12
Wednesday 4/14
- Preparation for Final Lab Project
- Simple Motor Control
- Notes
Friday 4/16
- The MC9S12 in Expanded Mode - Using MSI logic to build ports
- Huang Chapter 14
Device Users Guide
- Notes
Monday 4/19
- Motor Speed Control using Fuzzy Logic
- Notes
Wednesday 4/21
- More on Motor Speed Control using Fuzzy Logic
- Notes
Friday 4/23
- Calling an Assembly Language Function from C
- Brief Survey of Microprocessors and Microcontrollers
- Notes
Monday 4/26
- Brief Survey of Microprocessors and Microcontrollers
- Notes
Wednesday 4/28
Friday 4/30
Monday 5/3
- Review for Final Exam
- Notes
Wednesday 5/5
- Review for Final Exam
- Notes
Friday 5/7
- Review for Final Exam
- Notes
Tuesday 5/11
Bill Rison,
<rison@ee.nmt.edu >