Professional Documents
Culture Documents
Lecture 1
Lecture 1
Embedded Systems/Microcontroller
Laboratory
Lecture 1
Course Overview & Introduction to Microcontrollers
3
Key Concepts in ESE 350
•Understand microcontroller operation at the Assembly
Language level
•Program microcontrollers (using C Language)
•Interface microcontrollers to actuators, sensors, and output
devices
•Apply interrupts
•Utilize timer functions to measure input signals and
generate output waveforms
•Communicate using the Serial Communication Interface
•Use the built-in Analog-to-Digital Converter to capture real
world analog signals
4
Tentative Schedule
Readings & lectures support the concepts in the lab projects.
Reading Lecture Lab
Week
1/14 Introduction to HCS12 Form lab groups
Assembly
1/21 C & CodeWarrior Environment Lab sessions begin
HCS12 Peripherals
1/28 Interfacing HCS12
2/4 Stack & Subroutines Lab 1-Switching Lights
Interrupts due
2/11 Timer & Input Capture
2/18 Output-Compare Lab 2-Morse Code
Detector due
2/25 Midterm Exam
5
Tentative Schedule-Continued
Reading Lecture Lab
Week
3/3 Serial Communication Interface Lab 3-Musical Keypad due
Motors & Pulse Width Modulation
3/10 Spring Break
3/17 Feedback
3/24 Analog-to-Digital Converter Lab 4-Motor Controller due
3/31 Operation Modes & Memory
4/7 Microcontroller Projects Lab 5-Sound Meter due
4/14 TBD
4/21 Presentations Final Project demonstrations
6
Lab Organization
Labs are performed in teams.
•Each team must consist of at least
1 EE/CTE major
1 Systems major
Maximum 3 students per group unless approved by ESE 350
staff-IDEALLY we want a team of 2 Students
•Each member of the team must
Participate in the labs
Be present during demonstrations
Submit a separate written lab report
•Code listings and circuit diagrams can be shared within the group
•If you are unable to find a partner/partners by next week, please inform
the staff
7
Microcontroller Lab Projects
There are 5 Labs and a Final Project. Each successive lab
builds upon a previous lab. There will be a Pre-lab Quiz.
Lab What you will do: What you will learn:
8
Labs-Continued
Lab What you will do: What you will learn:
3. Musical Build a programmable Understand how to use output compare
Keypad tone generator using a functions to generate waveforms and apply
keypad and piezoelectric real-time interrupts to implement a keypad
speaker scanning scheme
4. Motor Build motor control Be able to generate pulse width modulated
Controller systems that control the outputs, measure pulses using a pulse
speed of a DC motor and accumulator and apply feedback to control
position of a servo motor motors
5. Sound Build a system that Gain familiarity with the built-in analog-to-
Meter monitors the loudness of digital (A/D) converter
surrounding sounds
9
Definitions
I/O CPU Memory
I/O: Input/Output
CPU: Central Processing Unit
10
Computer System
CPU is the ”brain” of the computer
1. ALU-Arithmetic and Logic Unit, operates on data
2. Control-directs operation for ALU, fetches instruction from memory,
provides timing and control signals
CPU
Input/Output-Peripherals
ALU (Input: Keyboard, drives
Output: Printer, video monitor)
Input Control Output
Control
Memory
Data
Memory stores instructions and data Address
(ROM, RAM)
11
Simplified MC9S12C128 CPU
Simplified MC9S12C128 CPU
Buses: 3 Types-Address [16], Data [8], and Control [8]
14
MC9S12C128 Features
- 16-bit CPU
- 12,288 bytes SRAM
- 4096 bytes EEPROM
- 262,144 bytes Flash EEPROM
- 8 Input Capture/Output Compare Channels
- 16-bit Pulse Accumulator
- One Serial Communication Interface (SCI)
- One Serial Peripheral Interface (SPI)
- Real-Time Interrupt (RTI) circuit
- 8-channel 8-bit A/D converter
- Computer Operate Properly (COP) Watchdog System
Source: Course Text
15
MC9S12C128 Programmer’s Model
Internal registers that
programmer can control using
instruction set.
16
Microcontroller Applications
Utility metering
Portable medical and instrumentation
Intelligent sensing
Consumer electronics-remote, gaming, toys, home electronics
Security systems-smoke, motion and glass break detector
Low power wireless-wireless sensor networks
PC Peripherals
Building automation-light, temperature, process control